Section 1
//Ball (com.Game.Ball)
package com.Game {
public class Ball extends CMovieClip {
public var startY:Number;
public var angle:Number;
public var startTime:Number;
public var speedX:Number;
public var speedY:Number;
public var type:Number;
public function Ball(_arg1:Number){
super(("Ball" + (_arg1 + 1)));
this.type = _arg1;
}
}
}//package com.Game
Section 2
//CMovieClip (com.Game.CMovieClip)
package com.Game {
import flash.display.*;
import flash.events.*;
import com.Game.*;
import flash.utils.*;
class CMovieClip {
var mc:MovieClip;
var rot:Number;
function CMovieClip(_arg1:String){
var _local2:Object;
super();
_local2 = getDefinitionByName(_arg1);
mc = new (_local2);
mc.x = -1000;
mc.y = -1000;
mc.cacheAsBitmap = true;
mc.stageFocusRect = false;
rot = 0;
}
public function IsVisible():Boolean{
return (mc.visible);
}
public function GetRot():Number{
return (mc.rotation);
}
public function GetFade():Number{
return (mc.alpha);
}
public function AddRot(_arg1:Number){
rot = (rot + _arg1);
SetRot(rot);
}
public function SetY(_arg1:Number){
mc.y = _arg1;
}
public function Destroy(){
mc = null;
}
public function SetX(_arg1:Number){
mc.x = _arg1;
}
public function SetFade(_arg1:Number){
if (mc.alpha != _arg1){
mc.alpha = _arg1;
if (mc.alpha > 1){
mc.alpha = 1;
};
if (mc.alpha < 0){
mc.alpha = 0;
};
};
}
public function Hide(){
mc.visible = false;
}
public function GetY():Number{
return (mc.y);
}
public function Show(){
mc.visible = true;
}
public function SetScale(_arg1:Number, _arg2:Number){
if (mc.scaleX != _arg1){
mc.scaleX = _arg1;
};
if (mc.scaleY != _arg2){
mc.scaleY = _arg2;
};
}
public function GetX():Number{
return (mc.x);
}
public function SetMouseCallBacks(_arg1:Function, _arg2:Function, _arg3:Function){
mc.useHandCursor = true;
mc.buttonMode = true;
if (_arg1 != null){
mc.addEventListener(MouseEvent.MOUSE_OVER, _arg1);
};
if (_arg2 != null){
mc.addEventListener(MouseEvent.MOUSE_OUT, _arg2);
};
if (_arg3 != null){
mc.addEventListener(MouseEvent.CLICK, _arg3);
};
}
public function GetWidth():Number{
return (mc.width);
}
public function SetPos(_arg1:Number, _arg2:Number){
mc.x = _arg1;
mc.y = _arg2;
}
public function SetRot(_arg1:Number){
rot = _arg1;
if (mc.rotation != rot){
mc.rotation = rot;
};
}
public function AddX(_arg1:Number){
mc.x = (mc.x + _arg1);
}
public function AddY(_arg1:Number){
mc.y = (mc.y + _arg1);
}
public function GetHeight():Number{
return (mc.height);
}
}
}//package com.Game
Section 3
//Config (com.Game.Config)
package com.Game {
public class Config {
public static var BALL_SHOOTMINANGLE:Number = -80;
public static var BALL_SHOOTY:Number = 345;
public static var LEVEL_ARCADE_INITIALROWS:Number = 2999;
public static var EXPLODE_TIME:Number = 200;
public static var LEVEL_TYPESINCREASE:Number = 0.5;
public static var BALL_DIMENSIONX:Number = 14;
public static var EXPLODE_DEGREES:Number = 90;
public static var SCORE_DROP:Number = 50;
public static var LEVEL_MOVESPEEDINCREASE:Number = 0.2;
public static var LEVEL_ROWSINCREASE:Number = 2;
public static var LEVEL_INITIALROWS:Number = 5;
public static var BALL_SHOOTMAXANGLE:Number = 80;
public static var BALL_DROPACCELERATION:Number = 1000;
public static var LEVEL_INITIALTYPES:Number = 3;
public static var MESSAGE_WINTIME:Number = 1000;
public static var BALL_HITSIZE:Number = 25;
public static var BALL_INITIALROWS:Number = 6;
public static var BALL_SIZE:Number = 30;
public static var BALL_COLOURS:Array = [0xFF0000, 0xFFFF00, 3368703, 0xFF00, 0xFF00FF, 0xFFFF, 0xFF9900];
public static var BALL_SHOOTSPEED:Number = 1000;
public static var LEVEL_INITIALMOVESPEED:Number = 3.5;
public static var TIPS_URL:String = "http://www.oceanbreezegames.com/";
public static var SCORE_GROUP:Number = 100;
public static var MESSAGE_LEVELTIME:Number = 1000;
public static var BALL_GAMEOVERSPEED:Number = 500;
public static var GROUPSIZE:Number = 3;
public static var SCORE_EXTRABALL:Number = 50;
public static var MESSAGE_GAMEOVERTIME:Number = 1000;
public static var STAR_APPEARINTERVAL:Number = 10;
public static var STAR_APPEARTIME:Number = 500;
public static var SCORE_STAR:Number = 15;
}
}//package com.Game
Section 4
//CSlider (com.Game.CSlider)
package com.Game {
import flash.events.*;
import com.Standard.*;
public class CSlider extends CMovieClip {
private var dragging:Boolean;
private var x1:Number;
private var x2:Number;
private var distance:Number;
public static var isAlreadyDragging:Boolean;
public function CSlider(_arg1:Number, _arg2:Number, _arg3:Number){
super("ThumbTracker");
mc.x = _arg1;
mc.y = _arg3;
x1 = mc.x;
x2 = _arg2;
isAlreadyDragging = false;
mc.addEventListener(MouseEvent.MOUSE_DOWN, grabThumbSlider);
mc.addEventListener(MouseEvent.MOUSE_UP, releaseThumbSlider);
}
public function grabThumbSlider(_arg1:MouseEvent){
if (!isAlreadyDragging){
dragging = true;
isAlreadyDragging = true;
};
}
public function SetPosition(_arg1:Number):void{
mc.x = (((x2 - x1) * _arg1) + x1);
}
public function GetPosition():Number{
return (((x1 - mc.x) / (x1 - x2)));
}
public function Update(_arg1):Boolean{
var _local2:Boolean;
_local2 = false;
if (((!(MainDevelopment.mouseOnStage)) || ((MainDevelopment.mUp == true)))){
dragging = false;
isAlreadyDragging = false;
};
if (dragging){
_local2 = true;
mc.x = _arg1;
if (mc.x > x2){
mc.x = x2;
};
if (mc.x < x1){
mc.x = x1;
};
};
return (_local2);
}
public function releaseThumbSlider(_arg1:MouseEvent){
dragging = false;
isAlreadyDragging = false;
}
}
}//package com.Game
Section 5
//CSoundClip (com.Game.CSoundClip)
package com.Game {
import flash.media.*;
import flash.utils.*;
class CSoundClip {
var currVol:Number;
var sound:Sound;
var sc:SoundChannel;
var isMusic:Boolean;
var position:Number;
var bPlaying:Boolean;
var timeStep:Number;
function CSoundClip(_arg1:String, _arg2:Boolean){
var _local3:Object;
super();
_local3 = getDefinitionByName(_arg1);
sound = new (_local3);
sc = null;
timeStep = 0;
isMusic = _arg2;
bPlaying = false;
}
public function fadeInLoop(_arg1:Number, _arg2:Boolean, _arg3:Number){
timeStep = (1 / _arg1);
if (!bPlaying){
loop((_arg2) ? position : 0, 0, _arg3);
};
}
public function fadeIn(_arg1:Number, _arg2:Boolean){
timeStep = (1 / _arg1);
if (!bPlaying){
play((_arg2) ? position : 0, 0);
};
}
public function stop(){
if (sc != null){
position = sc.position;
sc.stop();
};
bPlaying = false;
}
public function fadeOut(_arg1:Number){
timeStep = (-1 / _arg1);
bPlaying = false;
}
public function Destroy(){
stop();
sound = null;
}
public function setVolume(_arg1:Number, _arg2:Boolean=false){
var _local3:Boolean;
var _local4:SoundTransform;
if (sc == null){
return (false);
};
_local3 = false;
if ((((_arg1 > 1)) || ((_arg1 < 0)))){
_local3 = true;
};
if (_arg1 > 1){
_arg1 = 1;
currVol = 1;
};
if (_arg1 < 0){
_arg1 = 0;
currVol = 0;
};
_local4 = sc.soundTransform;
_local4.volume = _arg1;
sc.soundTransform = _local4;
return (_local3);
}
public function loop(_arg1:Number, _arg2:Number, _arg3:Number){
sc = sound.play(_arg1, _arg3);
currVol = _arg2;
setVolume(_arg2, false);
bPlaying = true;
}
public function Update(_arg1:Number){
if (timeStep != 0){
currVol = (currVol + (timeStep * _arg1));
if (setVolume(currVol, true)){
if (currVol == 0){
stop();
};
timeStep = 0;
};
};
}
public function play(_arg1:Number=0, _arg2:Number=1){
sc = sound.play(_arg1);
currVol = _arg2;
setVolume(_arg2, false);
bPlaying = true;
}
}
}//package com.Game
Section 6
//Game (com.Game.Game)
package com.Game {
import flash.display.*;
import flash.events.*;
import com.Standard.*;
import flash.media.*;
import flash.geom.*;
import mochi.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
public class Game extends Game {
public var message:Message;
public var arrow:MovieClip;
private var soundHit:CSoundClip;
private var shootingBall:Ball;
private var leftPressed:Boolean;
private var soundGameOver:CSoundClip;
private var music:CSoundClip;
public var MusicTrack:SlideTrack;
private var soundShoot:CSoundClip;
private var balls:Array;
private var stars:Array;
private var soundWin:CSoundClip;
private var rightPressed:Boolean;
private var startTime:Number;
public var Quit:SimpleButton;
public var weight:MovieClip;
private var lastTime:Number;
private var nextBallToShoot:Ball;
private var dt:Number;
private var intervalID:Timer;
private var soundGroup:CSoundClip;
private var __score:Number;
private var ballInfos:Array;
private var angle:Number;
public var scoreText:TextField;
private var arcadeMode:Boolean;
private var moveSpeed:Number;
private var rowSpacing:Number;
public var ballsHolder:MovieClip;
private var startTopY:Number;
private var lastFullRow:Number;
private var ballToShoot:Ball;
private var musicSlider:CSlider;
private var ballGeneratedRow:Number;
public var starsHolder:MovieClip;
public var clickDetector:MovieClip;
private var currentLevel:Number;
private var usedColors:Array;
private var currentRow:Number;
private var topY:Number;
private var explodes:Array;
private var speedTime:Number;
private var soundGliss:CSoundClip;
private var arrowSpeed:Number;
public var VisitOBG:SimpleButton;
private var sfxSlider:CSlider;
public var shooterHolder:MovieClip;
private var noOfTypes:Number;
public var SfxTrack:SlideTrack;
private var droppingBalls:Array;
public var explodesHolder:MovieClip;
public function Game(_arg1:Boolean=true, _arg2:Boolean=false){
if (_arg1){
return;
};
dt = 0;
gameStage.focus = this;
this.focusRect = false;
gameStage.stageFocusRect = false;
Object(parent).focusRect = false;
this.arcadeMode = _arg2;
rowSpacing = ((Config.BALL_SIZE * Math.sqrt(3)) / 2);
usedColors = null;
leftPressed = false;
rightPressed = false;
arrowSpeed = 0;
score = 0;
arrow.x = (ballsHolder.x + ((Config.BALL_DIMENSIONX * Config.BALL_SIZE) / 2));
arrow.y = Config.BALL_SHOOTY;
soundShoot = new CSoundClip("com.Game.SoundShoot", false);
soundHit = new CSoundClip("com.Game.SoundHit", false);
soundGroup = new CSoundClip("com.Game.SoundGroup", false);
soundWin = new CSoundClip("com.Game.SoundWin", false);
soundGameOver = new CSoundClip("com.Game.SoundGameOver", false);
soundGliss = new CSoundClip("soundGliss", false);
sfxSlider = new CSlider((SfxTrack.x - (SfxTrack.width / 2)), (SfxTrack.x + (SfxTrack.width / 2)), SfxTrack.y);
musicSlider = new CSlider((MusicTrack.x - (MusicTrack.width / 2)), (MusicTrack.x + (MusicTrack.width / 2)), MusicTrack.y);
this.addChild(sfxSlider.mc);
this.addChild(musicSlider.mc);
sfxSlider.SetPosition(MainDevelopment.sfxVol);
musicSlider.SetPosition(MainDevelopment.musicVol);
startLevel(1);
}
private function startNextLevel(_arg1:TimerEvent):void{
intervalID.stop();
startLevel((currentLevel + 1));
}
private function showPlayAgain(_arg1:TimerEvent):void{
var _local2:Number;
destroy();
intervalID.stop();
_local2 = score;
if (Main.lbConnected){
if (arcadeMode){
MochiScores.showLeaderboard({boardID:"8bf09db80291767b", score:_local2, onClose:onDoneLB, onError:onErrorLB});
} else {
MochiScores.showLeaderboard({boardID:"a84d7d2e06348014", score:_local2, onClose:onDoneLB, onError:onErrorLB});
};
} else {
Object(parent).gotoTitlePage();
};
}
private function checkDrop():void{
var _local1:Array;
var _local2:Array;
var _local3:Number;
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:*;
var _local11:Ball;
var _local12:Point;
var _local13:*;
var _local14:*;
var _local15:Number;
_local1 = new Array();
_local2 = new Array();
_local4 = new Array();
_local13 = 0;
while (_local13 < ballInfos[(lastFullRow + 1)].length) {
if (ballInfos[(lastFullRow + 1)][_local13] == -1){
} else {
_local1.push(new Point(_local13, (lastFullRow + 1)));
};
_local13++;
};
_local13 = 0;
while (_local13 < _local1.length) {
_local7 = _local1[_local13].x;
_local8 = _local1[_local13].y;
if ((((_local7 > 0)) && (!((ballInfos[_local8][(_local7 - 1)] == -1))))){
addNonDuplicatePoint(_local1, new Point((_local7 - 1), _local8));
};
if ((((_local7 < (ballInfos[_local8].length - 1))) && (!((ballInfos[_local8][(_local7 + 1)] == -1))))){
addNonDuplicatePoint(_local1, new Point((_local7 + 1), _local8));
};
if ((_local8 % 2) == 0){
if (_local8 > (lastFullRow + 1)){
if ((((_local7 > 0)) && (!((ballInfos[(_local8 - 1)][(_local7 - 1)] == -1))))){
addNonDuplicatePoint(_local1, new Point((_local7 - 1), (_local8 - 1)));
};
if ((((_local7 < (Config.BALL_DIMENSIONX - 1))) && (!((ballInfos[(_local8 - 1)][_local7] == -1))))){
addNonDuplicatePoint(_local1, new Point(_local7, (_local8 - 1)));
};
};
if (_local8 < (ballInfos.length - 1)){
if ((((_local7 > 0)) && (!((ballInfos[(_local8 + 1)][(_local7 - 1)] == -1))))){
addNonDuplicatePoint(_local1, new Point((_local7 - 1), (_local8 + 1)));
};
if ((((_local7 < (Config.BALL_DIMENSIONX - 1))) && (!((ballInfos[(_local8 + 1)][_local7] == -1))))){
addNonDuplicatePoint(_local1, new Point(_local7, (_local8 + 1)));
};
};
} else {
if (_local8 > (lastFullRow + 1)){
if (ballInfos[(_local8 - 1)][_local7] != -1){
addNonDuplicatePoint(_local1, new Point(_local7, (_local8 - 1)));
};
if (ballInfos[(_local8 - 1)][(_local7 + 1)] != -1){
addNonDuplicatePoint(_local1, new Point((_local7 + 1), (_local8 - 1)));
};
};
if (_local8 < (ballInfos.length - 1)){
if (ballInfos[(_local8 + 1)][_local7] != -1){
addNonDuplicatePoint(_local1, new Point(_local7, (_local8 + 1)));
};
if (ballInfos[(_local8 + 1)][(_local7 + 1)] != -1){
addNonDuplicatePoint(_local1, new Point((_local7 + 1), (_local8 + 1)));
};
};
};
_local13++;
};
_local13 = (lastFullRow + 1);
while (_local13 < ballInfos.length) {
_local2[_local13] = new Array();
_local13++;
};
_local13 = 0;
while (_local13 < _local1.length) {
_local2[_local1[_local13].y][_local1[_local13].x] = true;
_local13++;
};
_local3 = 0;
_local6 = NewTimer.getTimer();
_local13 = (lastFullRow + 1);
while (_local13 < ballInfos.length) {
_local14 = 0;
while (_local14 < ballInfos[_local13].length) {
if (balls[_local13] == undefined){
} else {
if (ballInfos[_local13][_local14] == -1){
} else {
if (_local2[_local13][_local14]){
} else {
if (balls[_local13][_local14]){
balls[_local13][_local14].startTime = _local6;
balls[_local13][_local14].startY = balls[_local13][_local14].mc.y;
droppingBalls.push(balls[_local13][_local14]);
} else {
_local11 = new Ball(ballInfos[_local13][_local14]);
_local12 = getXYFromPosition(new Point(_local14, _local13));
_local11.mc.x = _local12.x;
_local11.mc.y = _local12.y;
_local11.startTime = _local6;
_local11.startY = _local12.y;
ballsHolder.addChild(_local11.mc);
droppingBalls.push(_local11);
};
ballInfos[_local13][_local14] = -1;
_local3++;
};
};
};
_local14++;
};
_local13++;
};
_local15 = 1;
if (_local3 > 7){
soundGliss.play(0, sfxSlider.GetPosition());
_local15 = 2;
};
_local5 = ((_local4.length * Config.SCORE_DROP) * _local15);
score = (score + _local5);
}
private function getStickPosition(_arg1:Point, _arg2:Point, _arg3:Number):Point{
var _local4:Point;
var _local5:Point;
var _local6:Array;
var _local7:Point;
var _local8:*;
_local4 = getHitPosition(_arg2);
if (!_local4){
return (null);
};
_local5 = getXYFromPosition(_local4);
_local6 = getStickDirections(_local5, _arg2, _arg3);
_local8 = 0;
while (_local8 < _local6.length) {
_local7 = getStickPositionFromDirection(_local4, _local6[_local8]);
if (!getPositionIsValid(_local7)){
} else {
if (!getPositionIsOccupied(_local7)){
return (_local7);
};
};
_local8++;
};
return (null);
}
private function generateNextBallToShoot():void{
var _local1:Array;
var _local2:*;
var _local3:Number;
var _local4:*;
if (!arcadeMode){
_local1 = new Array(false, false, false, false, false, false, false);
_local2 = (balls.length - 1);
while (_local2 >= 0) {
if (y < (-(Config.BALL_SIZE) / 2)){
break;
};
if (balls[_local2]){
_local4 = 0;
while (_local4 < balls[_local2].length) {
if (!balls[_local2][_local4]){
} else {
_local1[balls[_local2][_local4].type] = true;
};
_local4++;
};
} else {
_local2 = 0;
};
_local2--;
};
_local3 = Math.floor((Math.random() * noOfTypes));
while (!(_local1[_local3])) {
_local3 = Math.floor((Math.random() * noOfTypes));
};
nextBallToShoot = new Ball(_local3);
} else {
nextBallToShoot = new Ball(Math.floor((Math.random() * noOfTypes)));
};
nextBallToShoot.mc.x = (arrow.x - ballsHolder.x);
nextBallToShoot.mc.y = (arrow.y + Config.BALL_SIZE);
shooterHolder.addChild(nextBallToShoot.mc);
}
private function startLevel(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:Number;
var _local5:Number;
var _local6:*;
var _local7:Number;
arrowSpeed = 0;
speedTime = 50;
if (usedColors != null){
usedColors.splice(0, usedColors.length);
usedColors = null;
};
usedColors = new Array();
_local2 = 0;
while (_local2 < Config.BALL_COLOURS.length) {
usedColors[_local2] = false;
_local2++;
};
_local3 = Config.LEVEL_INITIALROWS;
if (arcadeMode){
_local3 = Config.LEVEL_ARCADE_INITIALROWS;
};
_local4 = (_local3 + ((_arg1 - 1) * Config.LEVEL_ROWSINCREASE));
currentLevel = _arg1;
noOfTypes = Math.floor((Config.LEVEL_INITIALTYPES + ((_arg1 - 1) * Config.LEVEL_TYPESINCREASE)));
if (noOfTypes > Config.BALL_COLOURS.length){
noOfTypes = Config.BALL_COLOURS.length;
};
moveSpeed = (Config.LEVEL_INITIALMOVESPEED + ((_arg1 - 1) * Config.LEVEL_MOVESPEEDINCREASE));
ballInfos = new Array();
_local7 = 0;
_local2 = (_local4 - 1);
while (_local2 >= 0) {
if ((_local2 % 2) == 0){
_local5 = Config.BALL_DIMENSIONX;
} else {
_local5 = (Config.BALL_DIMENSIONX - 1);
};
ballInfos[_local2] = new Array();
if (arcadeMode){
if ((_local2 % 18) == 0){
noOfTypes++;
if (noOfTypes > Config.BALL_COLOURS.length){
noOfTypes = Config.BALL_COLOURS.length;
};
};
};
_local6 = 0;
while (_local6 < _local5) {
ballInfos[_local2][_local6] = Math.floor((Math.random() * noOfTypes));
_local6++;
};
_local2--;
};
if (arcadeMode){
noOfTypes = Math.floor((Config.LEVEL_INITIALTYPES + ((_arg1 - 1) * Config.LEVEL_TYPESINCREASE)));
if (noOfTypes > Config.BALL_COLOURS.length){
noOfTypes = Config.BALL_COLOURS.length;
};
};
startTopY = (-((_local4 - Config.BALL_INITIALROWS)) * rowSpacing);
topY = startTopY;
lastFullRow = (_local4 - 1);
weight.y = topY;
balls = new Array();
ballGeneratedRow = _local4;
currentRow = _local4;
if (explodes){
_local2 = 0;
while (_local2 < explodes.length) {
explodesHolder.removeChild(explodes[_local2]);
_local2++;
};
};
explodes = new Array();
if (droppingBalls){
_local2 = 0;
while (_local2 < droppingBalls.length) {
ballsHolder.removeChild(droppingBalls[_local2]);
_local2++;
};
};
droppingBalls = new Array();
generateBalls(0);
if (arcadeMode){
startPlay(null);
} else {
message.showLevel(_arg1);
intervalID = new NewTimer(Config.MESSAGE_LEVELTIME, 0);
intervalID.addEventListener(TimerEvent.TIMER, startPlay);
intervalID.start();
};
leftPressed = false;
rightPressed = false;
}
private function moveShootingBall(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Point;
var _local7:Point;
var _local8:Point;
var _local9:Boolean;
var _local10:*;
if (!shootingBall){
return;
};
_local2 = (Math.floor(((Config.BALL_SHOOTSPEED * _arg1) / Config.BALL_SIZE)) + 1);
_local3 = ((shootingBall.speedX * _arg1) / _local2);
_local4 = ((shootingBall.speedY * _arg1) / _local2);
_local5 = ((_local3 > 0)) ? Math.abs(shootingBall.angle) : -(Math.abs(shootingBall.angle));
_local9 = false;
_local6 = new Point(shootingBall.mc.x, shootingBall.mc.y);
_local7 = _local6.clone();
_local10 = 0;
while (_local10 < _local2) {
_local7.x = (_local7.x + _local3);
if (_local7.x <= (Config.BALL_SIZE / 2)){
_local7.x = (Config.BALL_SIZE - _local7.x);
_local3 = -(_local3);
shootingBall.speedX = -(shootingBall.speedX);
} else {
if (_local7.x >= ((Config.BALL_SIZE * Config.BALL_DIMENSIONX) - (Config.BALL_SIZE / 2))){
_local7.x = ((((Config.BALL_SIZE * Config.BALL_DIMENSIONX) * 2) - Config.BALL_SIZE) - _local7.x);
_local3 = -(_local3);
shootingBall.speedX = -(shootingBall.speedX);
};
};
_local7.y = (_local7.y + _local4);
_local8 = getStickPosition(_local6, _local7, _local5);
if ((((_local8 == null)) && ((_local7.y <= (topY + (Config.BALL_SIZE / 2)))))){
_local8 = new Point(Math.floor((_local7.x / Config.BALL_SIZE)), 0);
if ((((ballInfos.length > 0)) && (!((ballInfos[0][_local8.x] == -1))))){
_local8.x++;
};
};
if (_local8){
soundHit.play(0, sfxSlider.GetPosition());
_local7 = getXYFromPosition(_local8);
addBallInfo(_local8.x, _local8.y, shootingBall);
_local9 = true;
break;
};
_local10++;
};
shootingBall.mc.x = _local7.x;
shootingBall.mc.y = _local7.y;
if (_local9){
shootingBall = null;
checkDestroy(_local8.x, _local8.y);
};
}
public function get score():Number{
return (__score);
}
private function onErrorLB(_arg1){
Object(parent).gotoTitlePage();
}
private function moveExplodes(_arg1:Number):void{
var _local2:Number;
var _local3:*;
_local3 = 0;
while (_local3 < explodes.length) {
_local2 = ((_arg1 - explodes[_local3].startTime) / Config.EXPLODE_TIME);
if (_local2 >= 1){
explodesHolder.removeChild(explodes[_local3].mc);
explodes.splice(_local3, 1);
_local3--;
} else {
explodes[_local3].mc.rotation = (_local2 * Config.EXPLODE_DEGREES);
explodes[_local3].mc.scaleX = (1 - _local2);
explodes[_local3].mc.scaleY = (1 - _local2);
};
_local3++;
};
}
private function getHitPosition(_arg1:Point):Point{
var _local2:Point;
var _local3:Number;
var _local4:Number;
var _local5:*;
var _local6:*;
_local2 = new Point(0, 0);
_local4 = (Math.floor((((_arg1.y - topY) - Config.BALL_SIZE) / rowSpacing)) - 1);
if (_local4 < 0){
_local4 = 0;
};
_local3 = (_local4 + 2);
if (_local4 >= ballInfos.length){
_local4 = (ballInfos.length - 1);
};
_local2.y = ((topY + (_local3 * rowSpacing)) + (Config.BALL_SIZE / 2));
_local5 = _local3;
while (_local5 >= _local4) {
if ((_local5 % 2) == 0){
_local2.x = (Config.BALL_SIZE / 2);
} else {
_local2.x = Config.BALL_SIZE;
};
if (ballInfos[_local5]){
_local6 = 0;
while (_local6 < ballInfos[_local5].length) {
if (ballInfos[_local5][_local6] != -1){
if (Point.distance(_local2, _arg1) < Config.BALL_HITSIZE){
return (new Point(_local6, _local5));
};
};
_local2.x = (_local2.x + Config.BALL_SIZE);
_local6++;
};
};
_local2.y = (_local2.y - rowSpacing);
_local5--;
};
return (null);
}
private function startPlay(_arg1:TimerEvent):void{
if (!arcadeMode){
intervalID.stop();
};
message.hide();
generateNextBallToShoot();
ballToShoot = nextBallToShoot;
ballToShoot.mc.y = Config.BALL_SHOOTY;
generateNextBallToShoot();
shootingBall = null;
clickDetector.addEventListener(MouseEvent.MOUSE_DOWN, shootBall);
gameStage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
gameStage.addEventListener(KeyboardEvent.KEY_UP, keyUp);
Quit.addEventListener(MouseEvent.CLICK, clickQuit);
VisitOBG.addEventListener(MouseEvent.CLICK, visitOBG);
clickDetector.buttonMode = false;
startTime = NewTimer.getTimer();
lastTime = startTime;
intervalID = new NewTimer(1, 0);
intervalID.addEventListener(TimerEvent.TIMER, onPlayTime);
intervalID.start();
}
private function shootBall(_arg1:MouseEvent):void{
if (shootingBall){
return;
};
soundShoot.play(0, sfxSlider.GetPosition());
shootingBall = ballToShoot;
shootingBall.speedX = (Math.sin(((angle * Math.PI) / 180)) * Config.BALL_SHOOTSPEED);
shootingBall.speedY = (-(Math.cos(((angle * Math.PI) / 180))) * Config.BALL_SHOOTSPEED);
shootingBall.angle = angle;
ballToShoot = nextBallToShoot;
ballToShoot.mc.x = (arrow.x - ballsHolder.x);
ballToShoot.mc.y = Config.BALL_SHOOTY;
generateNextBallToShoot();
}
private function addNonDuplicatePoint(_arg1:Array, _arg2:Point):void{
var _local3:*;
_local3 = 0;
while (_local3 < _arg1.length) {
if ((((_arg1[_local3].x == _arg2.x)) && ((_arg1[_local3].y == _arg2.y)))){
return;
};
_local3++;
};
_arg1.push(_arg2);
}
private function checkNextShootBall():void{
var _local1:Array;
var _local2:*;
var _local3:*;
var _local4:Number;
if (!arcadeMode){
_local1 = new Array(false, false, false, false, false, false, false);
_local2 = (balls.length - 1);
while (_local2 >= 0) {
if (y < (-(Config.BALL_SIZE) / 2)){
break;
};
if (balls[_local2]){
_local3 = 0;
while (_local3 < balls[_local2].length) {
if (!balls[_local2][_local3]){
} else {
_local1[balls[_local2][_local3].type] = true;
};
_local3++;
};
} else {
_local2 = 0;
};
_local2--;
};
if (!_local1[ballToShoot.type]){
shooterHolder.removeChild(ballToShoot.mc);
_local4 = Math.floor((Math.random() * noOfTypes));
while (!(_local1[_local4])) {
_local4 = Math.floor((Math.random() * noOfTypes));
};
ballToShoot = new Ball(_local4);
ballToShoot.mc.x = (arrow.x - ballsHolder.x);
ballToShoot.mc.y = Config.BALL_SHOOTY;
shooterHolder.addChild(ballToShoot.mc);
};
};
}
private function addBallInfo(_arg1:Number, _arg2:Number, _arg3:Ball):void{
var _local4:Number;
var _local5:*;
shooterHolder.removeChild(_arg3.mc);
ballsHolder.addChild(_arg3.mc);
if (!ballInfos[_arg2]){
ballInfos[_arg2] = new Array();
_local4 = (((_arg2 % 2) == 0)) ? Config.BALL_DIMENSIONX : (Config.BALL_DIMENSIONX - 1);
_local5 = 0;
while (_local5 < _local4) {
ballInfos[_arg2][_local5] = -1;
_local5++;
};
};
if (!balls[_arg2]){
balls[_arg2] = new Array();
_local4 = (((_arg2 % 2) == 0)) ? Config.BALL_DIMENSIONX : (Config.BALL_DIMENSIONX - 1);
_local5 = 0;
while (_local5 < _local4) {
balls[_arg2][_local5] = null;
_local5++;
};
};
ballInfos[_arg2][_arg1] = _arg3.type;
balls[_arg2][_arg1] = _arg3;
}
private function moveBalls(_arg1:Number, _arg2:Boolean):void{
var _local3:Number;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
topY = (startTopY + ((moveSpeed * (_arg1 - startTime)) / 1000));
weight.y = topY;
_local3 = ((topY + ((balls.length - 1) * rowSpacing)) + (Config.BALL_SIZE / 2));
_local4 = (balls.length - 1);
while (_local4 >= 0) {
if (_local3 < (-(Config.BALL_SIZE) / 2)){
break;
};
if (balls[_local4]){
_local5 = 0;
while (_local5 < balls[_local4].length) {
if (!balls[_local4][_local5]){
} else {
balls[_local4][_local5].mc.y = _local3;
};
_local5++;
};
} else {
_local4 = 0;
};
_local3 = (_local3 - rowSpacing);
_local4--;
};
if (_arg2){
generateBalls(_arg1);
};
if (arcadeMode){
speedTime = (speedTime - ((_arg1 - lastTime) / 1000));
if (speedTime <= 0){
speedTime = 50;
_local6 = (moveSpeed + Config.LEVEL_MOVESPEEDINCREASE);
_local7 = ((moveSpeed * (_arg1 - startTime)) / 1000);
startTime = (_arg1 - ((_local7 / _local6) * 1000));
moveSpeed = _local6;
};
};
}
private function getGroupPoints(_arg1:Number, _arg2:Number):Array{
var _local3:Number;
var _local4:Array;
var _local5:*;
_local3 = ballInfos[_arg2][_arg1];
_local4 = new Array();
_local4.push(new Point(_arg1, _arg2));
_local5 = 0;
while (_local5 < _local4.length) {
_arg1 = _local4[_local5].x;
_arg2 = _local4[_local5].y;
if ((((((_arg1 > 0)) && ((ballInfos[_arg2][(_arg1 - 1)] == _local3)))) && ((balls[_arg2][(_arg1 - 1)].mc.y > -15)))){
addNonDuplicatePoint(_local4, new Point((_arg1 - 1), _arg2));
};
if ((((((_arg1 < (ballInfos[_arg2].length - 1))) && ((ballInfos[_arg2][(_arg1 + 1)] == _local3)))) && ((balls[_arg2][(_arg1 + 1)].mc.y > -15)))){
addNonDuplicatePoint(_local4, new Point((_arg1 + 1), _arg2));
};
if ((_arg2 % 2) == 0){
if (_arg2 > 0){
if (balls[(_arg2 - 1)] == undefined){
} else {
if ((((((_arg1 > 0)) && ((ballInfos[(_arg2 - 1)][(_arg1 - 1)] == _local3)))) && ((balls[(_arg2 - 1)][(_arg1 - 1)].mc.y > -15)))){
addNonDuplicatePoint(_local4, new Point((_arg1 - 1), (_arg2 - 1)));
};
if ((((((_arg1 < (Config.BALL_DIMENSIONX - 1))) && ((ballInfos[(_arg2 - 1)][_arg1] == _local3)))) && ((balls[(_arg2 - 1)][_arg1].mc.y > -15)))){
addNonDuplicatePoint(_local4, new Point(_arg1, (_arg2 - 1)));
};
};
};
if (_arg2 < (ballInfos.length - 1)){
if ((((((_arg1 > 0)) && ((ballInfos[(_arg2 + 1)][(_arg1 - 1)] == _local3)))) && ((balls[(_arg2 + 1)][(_arg1 - 1)].mc.y > -15)))){
addNonDuplicatePoint(_local4, new Point((_arg1 - 1), (_arg2 + 1)));
};
if ((((((_arg1 < (Config.BALL_DIMENSIONX - 1))) && ((ballInfos[(_arg2 + 1)][_arg1] == _local3)))) && ((balls[(_arg2 + 1)][_arg1].mc.y > -15)))){
addNonDuplicatePoint(_local4, new Point(_arg1, (_arg2 + 1)));
};
};
} else {
if (balls[(_arg2 - 1)] == undefined){
} else {
if ((((ballInfos[(_arg2 - 1)][_arg1] == _local3)) && ((balls[(_arg2 - 1)][_arg1].mc.y > -15)))){
addNonDuplicatePoint(_local4, new Point(_arg1, (_arg2 - 1)));
};
if ((((ballInfos[(_arg2 - 1)][(_arg1 + 1)] == _local3)) && ((balls[(_arg2 - 1)][(_arg1 + 1)].mc.y > -15)))){
addNonDuplicatePoint(_local4, new Point((_arg1 + 1), (_arg2 - 1)));
};
};
if (_arg2 < (ballInfos.length - 1)){
if ((((ballInfos[(_arg2 + 1)][_arg1] == _local3)) && ((balls[(_arg2 + 1)][_arg1].mc.y > -15)))){
addNonDuplicatePoint(_local4, new Point(_arg1, (_arg2 + 1)));
};
if ((((ballInfos[(_arg2 + 1)][(_arg1 + 1)] == _local3)) && ((balls[(_arg2 + 1)][(_arg1 + 1)].mc.y > -15)))){
addNonDuplicatePoint(_local4, new Point((_arg1 + 1), (_arg2 + 1)));
};
};
};
_local5++;
};
return (_local4);
}
private function checkGameOver():void{
var _local1:*;
if (((topY + ((ballInfos.length - 1) * rowSpacing)) + Config.BALL_SIZE) <= Config.BALL_SHOOTY){
return;
};
clickDetector.removeEventListener(MouseEvent.MOUSE_DOWN, shootBall);
gameStage.removeEventListener(KeyboardEvent.KEY_DOWN, keyDown);
gameStage.removeEventListener(KeyboardEvent.KEY_UP, keyUp);
Quit.removeEventListener(MouseEvent.CLICK, clickQuit);
VisitOBG.removeEventListener(MouseEvent.CLICK, visitOBG);
if (ballToShoot){
shooterHolder.removeChild(ballToShoot.mc);
};
if (nextBallToShoot){
shooterHolder.removeChild(nextBallToShoot.mc);
};
if (shootingBall){
shooterHolder.removeChild(shootingBall.mc);
};
message.showGameOver();
startTopY = topY;
moveSpeed = Config.BALL_GAMEOVERSPEED;
soundGameOver.play(0, sfxSlider.GetPosition());
intervalID.stop();
startTime = NewTimer.getTimer();
lastTime = startTime;
intervalID = new NewTimer(1, 0);
intervalID.addEventListener(TimerEvent.TIMER, onGameOverTime);
intervalID.start();
}
public function set score(_arg1:Number):void{
__score = _arg1;
scoreText.text = _arg1.toString();
}
private function onPlayTime(_arg1:TimerEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = NewTimer.getTimer();
_local3 = ((_local2 - lastTime) / 1000);
updateAngle();
moveBalls(_local2, true);
checkNextShootBall();
moveShootingBall(_local3);
moveExplodes(_local2);
moveDroppingBalls(_local2);
checkGameOver();
MainDevelopment.sfxVol = sfxSlider.GetPosition();
MainDevelopment.musicVol = musicSlider.GetPosition();
sfxSlider.Update(gameStage.mouseX);
musicSlider.Update(gameStage.mouseX);
setVolumes();
dt = ((_local2 - lastTime) / 1000);
lastTime = _local2;
_arg1.updateAfterEvent();
}
private function onDoneLB(){
Object(parent).gotoTitlePage();
}
private function getStickDirections(_arg1:Point, _arg2:Point, _arg3:Number):Array{
var _local4:Array;
var _local5:Array;
var _local6:Point;
var _local7:Point;
var _local8:Number;
var _local9:*;
_local4 = new Array();
_local5 = new Array();
if (_arg3 <= -60){
_local7 = new Point(1, -1);
_local6 = new Point((_arg1.x + (Config.BALL_SIZE / 2)), (_arg1.y - rowSpacing));
_local8 = Point.distance(_local6, _arg2);
insertDistanceSortedDirection(_local4, _local5, _local7, _local8);
};
if (_arg3 >= 60){
_local7 = new Point(-1, -1);
_local6 = new Point((_arg1.x - (Config.BALL_SIZE / 2)), (_arg1.y - rowSpacing));
_local8 = Point.distance(_local6, _arg2);
insertDistanceSortedDirection(_local4, _local5, _local7, _local8);
};
if (_arg3 <= 0){
_local7 = new Point(1, 0);
_local6 = new Point((_arg1.x + Config.BALL_SIZE), _arg1.y);
_local8 = Point.distance(_local6, _arg2);
insertDistanceSortedDirection(_local4, _local5, _local7, _local8);
};
if (_arg3 >= 0){
_local7 = new Point(-1, 0);
_local6 = new Point((_arg1.x - Config.BALL_SIZE), _arg1.y);
_local8 = Point.distance(_local6, _arg2);
insertDistanceSortedDirection(_local4, _local5, _local7, _local8);
};
if (_arg3 <= 60){
_local7 = new Point(1, 1);
_local6 = new Point((_arg1.x + (Config.BALL_SIZE / 2)), (_arg1.y + rowSpacing));
_local8 = Point.distance(_local6, _arg2);
insertDistanceSortedDirection(_local4, _local5, _local7, _local8);
};
if (_arg3 >= -60){
_local7 = new Point(-1, 1);
_local6 = new Point((_arg1.x - (Config.BALL_SIZE / 2)), (_arg1.y + rowSpacing));
_local8 = Point.distance(_local6, _arg2);
insertDistanceSortedDirection(_local4, _local5, _local7, _local8);
};
return (_local4);
}
private function onGameOverTime(_arg1:TimerEvent):void{
var _local2:Number;
var _local3:Boolean;
_local2 = NewTimer.getTimer();
_local3 = false;
if ((((_local2 - startTime) * Config.BALL_GAMEOVERSPEED) / 1000) >= ((Config.BALL_SHOOTY - startTopY) - (ballGeneratedRow * rowSpacing))){
_local2 = (startTime + ((((Config.BALL_SHOOTY - startTopY) - (ballGeneratedRow * rowSpacing)) * 1000) / Config.BALL_GAMEOVERSPEED));
_local3 = true;
};
moveBalls(_local2, false);
weight.y = (topY + (ballGeneratedRow * rowSpacing));
moveExplodes(_local2);
moveDroppingBalls(_local2);
lastTime = _local2;
if (_local3){
intervalID.stop();
intervalID = new NewTimer(Config.MESSAGE_GAMEOVERTIME, 0);
intervalID.addEventListener(TimerEvent.TIMER, showPlayAgain);
intervalID.start();
};
_arg1.updateAfterEvent();
}
private function getPositionIsValid(_arg1:Point):Boolean{
if (_arg1.y < 0){
return (false);
};
if (_arg1.x < 0){
return (false);
};
if ((_arg1.y % 2) == 0){
if (_arg1.x >= Config.BALL_DIMENSIONX){
return (false);
};
} else {
if (_arg1.x >= (Config.BALL_DIMENSIONX - 1)){
return (false);
};
};
return (true);
}
private function keyUp(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == "A".charCodeAt(0))) || ((_arg1.keyCode == 37)))){
leftPressed = false;
};
if ((((_arg1.keyCode == "D".charCodeAt(0))) || ((_arg1.keyCode == 39)))){
rightPressed = false;
};
}
private function getXYFromPosition(_arg1:Point):Point{
var _local2:Number;
var _local3:Number;
_local2 = (((_arg1.y % 2) == 0)) ? ((Config.BALL_SIZE / 2) + (Config.BALL_SIZE * _arg1.x)) : (Config.BALL_SIZE + (Config.BALL_SIZE * _arg1.x));
_local3 = ((topY + (_arg1.y * rowSpacing)) + (Config.BALL_SIZE / 2));
return (new Point(_local2, _local3));
}
private function updateAngle():void{
var _local1:Number;
if (leftPressed){
arrowSpeed = (arrowSpeed - (dt * 500));
if (arrowSpeed < -300){
arrowSpeed = -300;
};
arrow.x = (arrow.x + (dt * arrowSpeed));
} else {
if (rightPressed){
arrowSpeed = (arrowSpeed + (dt * 500));
if (arrowSpeed > 300){
arrowSpeed = 300;
};
arrow.x = (arrow.x + (dt * arrowSpeed));
} else {
if (arrowSpeed != 0){
if (arrowSpeed > 0){
arrowSpeed = (arrowSpeed - (dt * 1000));
if (arrowSpeed < 0){
arrowSpeed = 0;
};
arrow.x = (arrow.x + (dt * arrowSpeed));
} else {
if (arrowSpeed < 0){
arrowSpeed = (arrowSpeed + (dt * 1000));
if (arrowSpeed > 0){
arrowSpeed = 0;
};
arrow.x = (arrow.x + (dt * arrowSpeed));
};
};
};
};
};
if (arrow.x < 160){
arrow.x = 160;
};
if (arrow.x > 540){
arrow.x = 540;
};
ballToShoot.mc.x = (arrow.x - ballsHolder.x);
angle = ((Math.atan2((this.mouseX - arrow.x), (arrow.y - this.mouseY)) * 180) / Math.PI);
if (angle < Config.BALL_SHOOTMINANGLE){
angle = Config.BALL_SHOOTMINANGLE;
} else {
if (angle > Config.BALL_SHOOTMAXANGLE){
angle = Config.BALL_SHOOTMAXANGLE;
};
};
arrow.rotation = angle;
_local1 = (((angle * Math.PI) / 180) + (Math.PI / 2));
nextBallToShoot.mc.x = ((arrow.x - ballsHolder.x) + (Math.cos(_local1) * 33));
nextBallToShoot.mc.y = (arrow.y + (Math.sin(_local1) * 33));
}
private function getStickPositionFromDirection(_arg1:Point, _arg2:Point):Point{
var _local3:Number;
var _local4:Number;
_local4 = (_arg1.y + _arg2.y);
if (_arg2.y == 0){
_local3 = (_arg1.x + _arg2.x);
} else {
if ((_arg1.y % 2) == 0){
_local3 = ((_arg2.x == -1)) ? (_arg1.x - 1) : _arg1.x;
} else {
_local3 = ((_arg2.x == -1)) ? _arg1.x : (_arg1.x + 1);
};
};
return (new Point(_local3, _local4));
}
private function moveDroppingBalls(_arg1:Number):void{
var _local2:Number;
var _local3:*;
_local3 = 0;
while (_local3 < droppingBalls.length) {
_local2 = ((_arg1 - droppingBalls[_local3].startTime) / 1000);
droppingBalls[_local3].mc.y = (droppingBalls[_local3].startY + (((Config.BALL_DROPACCELERATION * _local2) * _local2) / 2));
if (droppingBalls[_local3].mc.y > (stage.stageHeight + (Config.BALL_SIZE / 2))){
ballsHolder.removeChild(droppingBalls[_local3].mc);
droppingBalls.splice(_local3, 1);
_local3--;
};
_local3++;
};
}
private function keyDown(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == "A".charCodeAt(0))) || ((_arg1.keyCode == 37)))){
leftPressed = true;
};
if ((((_arg1.keyCode == "D".charCodeAt(0))) || ((_arg1.keyCode == 39)))){
rightPressed = true;
};
}
private function visitOBG(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.oceanbreezegames.com/index.php?PLATFORM=Browser");
navigateToURL(_local2, "_blank");
}
private function insertDistanceSortedDirection(_arg1:Array, _arg2:Array, _arg3:Point, _arg4:Number):void{
var _local5:*;
_local5 = 0;
while (_local5 < _arg2.length) {
if (_arg4 < _arg2[_local5]){
break;
};
_local5++;
};
_arg1.splice(_local5, 0, _arg3);
_arg2.splice(_local5, 0, _arg4);
}
private function checkWin():void{
var _local1:Number;
var _local2:Number;
var _local3:MovieClip;
var _local4:*;
var _local5:*;
if (ballInfos.length > 0){
return;
};
clickDetector.removeEventListener(MouseEvent.MOUSE_DOWN, shootBall);
gameStage.removeEventListener(KeyboardEvent.KEY_DOWN, keyDown);
gameStage.removeEventListener(KeyboardEvent.KEY_UP, keyUp);
Quit.removeEventListener(MouseEvent.CLICK, clickQuit);
VisitOBG.removeEventListener(MouseEvent.CLICK, visitOBG);
shooterHolder.removeChild(ballToShoot.mc);
shooterHolder.removeChild(nextBallToShoot.mc);
_local1 = Math.floor(((Config.BALL_SHOOTY - topY) / Config.BALL_SIZE));
if (_local1 <= 0){
_local1 = 1;
};
stars = new Array();
_local4 = 0;
while (_local4 < _local1) {
_local5 = 0;
while (_local5 < Config.BALL_DIMENSIONX) {
_local3 = new Star();
_local3.x = ((Config.BALL_SIZE / 2) + (_local5 * Config.BALL_SIZE));
_local3.y = ((Config.BALL_SHOOTY - (Config.BALL_SIZE / 2)) - (_local4 * Config.BALL_SIZE));
_local3.visible = false;
starsHolder.addChild(_local3);
stars[((_local4 * Config.BALL_DIMENSIONX) + _local5)] = _local3;
_local5++;
};
_local4++;
};
message.showWin();
soundWin.play(0, sfxSlider.GetPosition());
intervalID.stop();
startTime = NewTimer.getTimer();
lastTime = startTime;
intervalID = new NewTimer(1, 0);
intervalID.addEventListener(TimerEvent.TIMER, onWinTime);
intervalID.start();
}
private function checkDestroy(_arg1:Number, _arg2:Number):void{
var _local3:Array;
var _local4:Number;
var _local5:Number;
var _local6:Ball;
var _local7:Number;
var _local8:*;
var _local9:*;
_local3 = getGroupPoints(_arg1, _arg2);
_local7 = Number.MAX_VALUE;
if (_local3.length < Config.GROUPSIZE){
return;
};
_local4 = (Config.SCORE_GROUP + ((_local3.length - Config.GROUPSIZE) * Config.SCORE_EXTRABALL));
score = (score + _local4);
_local8 = 0;
while (_local8 < _local3.length) {
_arg1 = _local3[_local8].x;
_arg2 = _local3[_local8].y;
if (balls[_arg2] == undefined){
} else {
if (balls[_arg2][_arg1]){
_local6 = new Ball(balls[_arg2][_arg1].type);
_local6.mc.x = balls[_arg2][_arg1].mc.x;
_local6.mc.y = balls[_arg2][_arg1].mc.y;
_local6.startTime = NewTimer.getTimer();
explodes.push(_local6);
explodesHolder.addChild(_local6.mc);
ballsHolder.removeChild(balls[_arg2][_arg1].mc);
balls[_arg2][_arg1] = null;
};
};
ballInfos[_arg2][_arg1] = -1;
if (_arg2 < _local7){
_local7 = _arg2;
};
_local8++;
};
if (_local7 <= lastFullRow){
lastFullRow = (_local7 - 1);
};
checkDrop();
_local8 = (ballInfos.length - 1);
while (_local8 >= 0) {
_local9 = 0;
while (_local9 < ballInfos[_local8].length) {
if (ballInfos[_local8][_local9] != -1){
break;
};
_local9++;
};
if (_local9 >= ballInfos[_local8].length){
balls.splice(_local8, 1);
ballInfos.splice(_local8, 1);
};
_local8--;
};
soundGroup.play(0, sfxSlider.GetPosition());
checkWin();
}
public function setVolumes():void{
soundShoot.setVolume(sfxSlider.GetPosition());
soundHit.setVolume(sfxSlider.GetPosition());
soundGroup.setVolume(sfxSlider.GetPosition());
soundWin.setVolume(sfxSlider.GetPosition());
soundGameOver.setVolume(sfxSlider.GetPosition());
soundGliss.setVolume(sfxSlider.GetPosition());
}
private function generateBalls(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:*;
var _local8:Ball;
var _local9:*;
var _local10:*;
_local2 = (Math.floor((-(topY) / rowSpacing)) - 1);
if (_local2 < 0){
_local2 = 0;
};
if (ballGeneratedRow <= _local2){
return;
};
_local5 = ((topY + ((ballGeneratedRow - 1) * rowSpacing)) + (Config.BALL_SIZE / 2));
_local9 = (ballGeneratedRow - 1);
while (_local9 >= _local2) {
if ((_local9 % 2) == 0){
_local3 = Config.BALL_DIMENSIONX;
_local4 = (Config.BALL_SIZE / 2);
} else {
_local3 = (Config.BALL_DIMENSIONX - 1);
_local4 = Config.BALL_SIZE;
};
if (!balls[_local9]){
balls[_local9] = new Array();
};
_local10 = 0;
while (_local10 < _local3) {
if (((!(balls[_local9][_local10])) && (!((ballInfos[_local9][_local10] == -1))))){
_local8 = new Ball(ballInfos[_local9][_local10]);
_local8.mc.x = _local4;
_local8.mc.y = _local5;
ballsHolder.addChild(_local8.mc);
balls[_local9][_local10] = _local8;
usedColors[ballInfos[_local9][_local10]] = true;
};
_local4 = (_local4 + Config.BALL_SIZE);
_local10++;
};
_local5 = (_local5 - rowSpacing);
_local9--;
};
if (arcadeMode){
noOfTypes = 0;
_local9 = 0;
while (_local9 < usedColors.length) {
if (usedColors[_local9]){
noOfTypes++;
};
_local9++;
};
};
ballGeneratedRow = _local2;
}
private function onWinTime(_arg1:TimerEvent):void{
var _local2:Number;
var _local3:Number;
var _local4:*;
_local2 = NewTimer.getTimer();
moveExplodes(_local2);
moveDroppingBalls(_local2);
_local4 = 0;
while (_local4 < stars.length) {
_local3 = ((_local2 - startTime) - (_local4 * Config.STAR_APPEARINTERVAL));
if ((((_local3 <= 0)) || ((_local3 >= Config.STAR_APPEARTIME)))){
stars[_local4].visible = false;
} else {
if (((lastTime - startTime) - (_local4 * Config.STAR_APPEARINTERVAL)) <= 0){
stars[_local4].visible = true;
score = (score + Config.SCORE_STAR);
};
stars[_local4].alpha = (1 - (_local3 / Config.STAR_APPEARTIME));
};
_local4++;
};
if (_local3 >= Config.STAR_APPEARTIME){
_local4 = 0;
while (_local4 < stars.length) {
starsHolder.removeChild(stars[_local4]);
_local4++;
};
intervalID.stop();
intervalID = new NewTimer(Config.MESSAGE_WINTIME, 0);
intervalID.addEventListener(TimerEvent.TIMER, startNextLevel);
intervalID.start();
};
lastTime = _local2;
_arg1.updateAfterEvent();
}
private function clickQuit(_arg1:MouseEvent):void{
clickDetector.removeEventListener(MouseEvent.MOUSE_DOWN, shootBall);
gameStage.removeEventListener(KeyboardEvent.KEY_DOWN, keyDown);
gameStage.removeEventListener(KeyboardEvent.KEY_UP, keyUp);
Quit.removeEventListener(MouseEvent.CLICK, clickQuit);
VisitOBG.removeEventListener(MouseEvent.CLICK, visitOBG);
shooterHolder.removeChild(ballToShoot.mc);
shooterHolder.removeChild(nextBallToShoot.mc);
intervalID.stop();
Object(parent).gotoTitlePage();
}
public function destroy():void{
this.removeChild(sfxSlider.mc);
this.removeChild(musicSlider.mc);
}
private function getPositionIsOccupied(_arg1:Point):Boolean{
if (!ballInfos[_arg1.y]){
return (false);
};
return (((!((ballInfos[_arg1.y][_arg1.x] == undefined))) && (!((ballInfos[_arg1.y][_arg1.x] == -1)))));
}
}
}//package com.Game
Section 7
//Main (com.Game.Main)
package com.Game {
import flash.display.*;
import flash.events.*;
import com.Standard.*;
import flash.media.*;
import CPMStar.*;
import mochi.*;
import flash.utils.*;
public dynamic class Main extends MainDevelopment {
public var ad:DisplayObject;
public var al:AdLoader;
public var adWaitTime:Number;
public var ShownAd:Boolean;
public var spText:MovieClip;
public var title:Title;
public var OldTime:Number;
public var trackWaitTime:Boolean;
public var adBox:MovieClip;
public var CPMStarSubPoolID:int;
public var CPMStarPoolID:int;
public var LoaderBar:MovieClip;
public var waitTime:Number;
public static var lbConnected:Boolean = true;
public function Main(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
this.focusRect = false;
}
override protected function getMusicGame():Sound{
return (new MusicGame());
}
public function adFrame(_arg1:Event){
var _local2:Number;
var _local3:Number;
var _local4:*;
var _local5:Number;
_local2 = getTimer();
_local3 = ((_local2 - OldTime) / 1000);
if (OldTime == 0){
_local3 = 0;
};
OldTime = _local2;
_local4 = (waitTime / 11);
_local5 = int((((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100) * _local4));
LoaderBar.InnerBar.width = ((_local5 / 100) * 574);
if ((((this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal)) && ((waitTime >= 11)))){
if (ad != null){
adBox.removeChild(ad);
};
this.removeEventListener("enterFrame", adFrame);
al = null;
play();
return;
};
adWaitTime = (adWaitTime + _local3);
waitTime = (waitTime + _local3);
}
function frame3(){
gotoAndPlay(10);
}
function frame1(){
adBox.visible = false;
LoaderBar.visible = false;
spText.visible = false;
stop();
Main.lbConnected = true;
ShownAd = false;
MochiAd.showPreGameAd({clip:root, id:"eb41ebfb11caa866", res:"600x400", color:9085760, background:4214799, outline:0, no_bg:true});
ShownAd = true;
MochiServices.connect("eb41ebfb11caa866", root, errorLoadingLB);
stage.showDefaultContextMenu = false;
waitTime = 0;
OldTime = 0;
adWaitTime = 0;
trackWaitTime = false;
if (ShownAd == false){
CPMStarPoolID = 1059;
CPMStarSubPoolID = 1100;
adBox.visible = true;
LoaderBar.visible = true;
spText.visible = true;
ad = AdLoader.LoadAd(CPMStarPoolID, CPMStarSubPoolID);
if (ad != null){
adBox.addChild(ad);
this.addEventListener("enterFrame", adFrame);
} else {
play();
};
};
}
override protected function getGame(_arg1:Boolean):Game{
return (new Game(false, _arg1));
}
function frame2(){
MochiBot.track(this, "9766125c");
stop();
}
public function errorLoadingLB(_arg1:String){
Main.lbConnected = false;
}
override protected function getTitle():Title{
return (title);
}
}
}//package com.Game
Section 8
//Message (com.Game.Message)
package com.Game {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class Message extends MovieClip {
public var level:Number;
private var messageLevel:MessageLevel;
public function Message(){
stop();
}
public function showGameOver():void{
gotoAndStop("gameOver");
}
private function playAgainButtonClicked(_arg1:MouseEvent):void{
Object(parent.parent).gotoGamePage();
}
public function hide():void{
if (messageLevel){
this.removeChild(messageLevel);
messageLevel = null;
};
gotoAndStop("hide");
}
public function showLevel(_arg1:Number):void{
this.level = _arg1;
gotoAndStop("hide");
messageLevel = new MessageLevel();
messageLevel.levelText.text = _arg1.toString();
this.addChild(messageLevel);
}
public function showWin():void{
gotoAndStop("win");
}
private function homeButtonClicked(_arg1:MouseEvent):void{
Object(parent.parent).gotoTitlePage();
}
}
}//package com.Game
Section 9
//MessageLevel (com.Game.MessageLevel)
package com.Game {
import flash.display.*;
import flash.text.*;
public dynamic class MessageLevel extends MovieClip {
public var levelText:TextField;
}
}//package com.Game
Section 10
//MusicGame (com.Game.MusicGame)
package com.Game {
import flash.media.*;
public dynamic class MusicGame extends Sound {
}
}//package com.Game
Section 11
//SoundGameOver (com.Game.SoundGameOver)
package com.Game {
import flash.media.*;
public dynamic class SoundGameOver extends Sound {
}
}//package com.Game
Section 12
//SoundGroup (com.Game.SoundGroup)
package com.Game {
import flash.media.*;
public dynamic class SoundGroup extends Sound {
}
}//package com.Game
Section 13
//SoundHit (com.Game.SoundHit)
package com.Game {
import flash.media.*;
public dynamic class SoundHit extends Sound {
}
}//package com.Game
Section 14
//SoundShoot (com.Game.SoundShoot)
package com.Game {
import flash.media.*;
public dynamic class SoundShoot extends Sound {
}
}//package com.Game
Section 15
//SoundWin (com.Game.SoundWin)
package com.Game {
import flash.media.*;
public dynamic class SoundWin extends Sound {
}
}//package com.Game
Section 16
//Star (com.Game.Star)
package com.Game {
import flash.display.*;
public dynamic class Star extends MovieClip {
}
}//package com.Game
Section 17
//Game (com.Standard.Game)
package com.Standard {
import flash.display.*;
public class Game extends MovieClip {
public static var gameStage:Stage;
public function unpause():void{
NewTimer.unpause();
}
public function pause():void{
NewTimer.pause();
}
}
}//package com.Standard
Section 18
//Instructions (com.Standard.Instructions)
package com.Standard {
import flash.display.*;
import flash.events.*;
import com.Game.*;
public class Instructions extends MovieClip {
public var ContinueToGameButton:SimpleButton;
private var arcadeMode:Boolean;
private var shownFromGame:Boolean;
public function Instructions(_arg1:Boolean=false, _arg2:Boolean=false){
if (parent != undefined){
if (Object(parent).currentFrame == 5){
return;
};
};
this.shownFromGame = _arg2;
this.arcadeMode = _arg1;
ContinueToGameButton.addEventListener(MouseEvent.CLICK, startButtonClicked);
}
private function startButtonClicked(_arg1:MouseEvent):void{
if (!shownFromGame){
Object(parent).gotoGamePage(arcadeMode);
} else {
Object(parent).hideInstructionsFromGame();
};
}
}
}//package com.Standard
Section 19
//MainDevelopment (com.Standard.MainDevelopment)
package com.Standard {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class MainDevelopment extends MovieClip {
private var title:Title;
private var titleIndex:int;
private var instructions:Instructions;
private var game:Game;
public static var mUp:Boolean = true;
public static var musicGameSoundChannel:SoundChannel;
public static var musicVol:Number = 0.6;
public static var sfxVol:Number = 0.9;
private static var musicGame:Sound = null;
public static var mouseOnStage:Boolean = true;
public function MainDevelopment(){
this.addEventListener(Event.ENTER_FRAME, checkTitle);
this.addEventListener(Event.ENTER_FRAME, generalUpdate);
stage.addEventListener(Event.MOUSE_LEAVE, mouseLeaveStage);
this.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
}
protected function getMusicGame():Sound{
return (null);
}
public function hideInstructionsFromGame():void{
this.removeChild(instructions);
instructions = null;
game.visible = true;
game.unpause();
}
public function mouseLeaveStage(_arg1:Event):void{
mouseOnStage = false;
}
public function mouseMove(_arg1:MouseEvent):void{
mouseOnStage = true;
}
public function gotoGamePage(_arg1:Boolean):void{
Game.gameStage = stage;
removePage();
game = getGame(_arg1);
this.addChildAt(game, titleIndex);
}
private function checkTitle(_arg1:Event):void{
if (!(title = getTitle())){
return;
};
this.removeEventListener(Event.ENTER_FRAME, checkTitle);
stop();
titleIndex = this.getChildIndex(title);
}
public function mouseUp(_arg1:MouseEvent):void{
mUp = true;
}
public function gotoTitlePage():void{
removePage();
title = new Title();
this.addChildAt(title, titleIndex);
}
public function gotoInstructionsPage():void{
removePage();
instructions = new Instructions();
this.addChildAt(instructions, titleIndex);
}
public function showHighScores():void{
trace("showHighScores()");
}
public function showEnterHighScore(_arg1:int):void{
trace((("showEnterHighScore(" + _arg1) + ")"));
}
protected function getGame(_arg1:Boolean):Game{
return (null);
}
private function removePage():void{
if (title){
removeChild(title);
title = null;
};
if (instructions){
removeChild(instructions);
instructions = null;
};
if (game){
removeChild(game);
game = null;
};
}
protected function getTitle():Title{
return (null);
}
public function gotoInstructionsPageArcade(_arg1:Boolean):void{
removePage();
instructions = new Instructions(_arg1);
this.addChildAt(instructions, titleIndex);
}
public function generalUpdate(_arg1:Event):void{
if (this.currentFrame > 5){
if ((((musicGame == null)) || ((musicGame == undefined)))){
musicGame = getMusicGame();
if (((!((musicGame == null))) && (!((musicGame == undefined))))){
musicGameSoundChannel = musicGame.play(0, int.MAX_VALUE);
setMusicVol();
};
} else {
setMusicVol();
};
};
}
public function mouseDown(_arg1:MouseEvent):void{
mUp = false;
}
public function setMusicVol():void{
var _local1:SoundTransform;
_local1 = musicGameSoundChannel.soundTransform;
_local1.volume = musicVol;
musicGameSoundChannel.soundTransform = _local1;
}
}
}//package com.Standard
Section 20
//NewTimer (com.Standard.NewTimer)
package com.Standard {
import flash.events.*;
import flash.utils.*;
public class NewTimer extends Timer {
private var adjustedStartTime:int;
private var listener:Function;
private var originalRepeatCount:int;
private var originalDelay:int;
private static var pauseTime:int;
private static var paused:Boolean = false;
private static var totalPausedTime:int = 0;
public function NewTimer(_arg1:Number, _arg2:int=0):void{
super(_arg1, _arg2);
originalDelay = _arg1;
originalRepeatCount = _arg2;
}
override public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
if (_arg1 != TimerEvent.TIMER){
super.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
return;
};
this.listener = _arg2;
super.addEventListener(_arg1, timerEventListener);
}
override public function start():void{
adjustedStartTime = NewTimer.getTimer();
super.start();
}
private function timerEventListener(_arg1:TimerEvent):void{
if (paused){
stop();
delay = Math.max((originalDelay - (NewTimer.getTimer() - adjustedStartTime)), 1);
if (originalRepeatCount > 0){
repeatCount++;
};
super.start();
return;
};
if ((NewTimer.getTimer() - adjustedStartTime) >= originalDelay){
adjustedStartTime = NewTimer.getTimer();
if (delay != originalDelay){
stop();
delay = originalDelay;
super.start();
};
listener(_arg1);
} else {
stop();
delay = Math.max((originalDelay - (NewTimer.getTimer() - adjustedStartTime)), 1);
if (originalRepeatCount > 0){
repeatCount++;
};
super.start();
};
}
public static function unpause():void{
if (!paused){
return;
};
paused = false;
totalPausedTime = (totalPausedTime + (getTimer() - pauseTime));
}
public static function getTimer():int{
if (paused){
return ((pauseTime - totalPausedTime));
};
return ((getTimer() - totalPausedTime));
}
public static function pause():void{
if (paused){
return;
};
paused = true;
pauseTime = getTimer();
}
}
}//package com.Standard
Section 21
//Title (com.Standard.Title)
package com.Standard {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class Title extends MovieClip {
public var ClassicDescription:MovieClip;
public var startButton:SimpleButton;
public var arcadeButton:SimpleButton;
public var ArcadeDescription:MovieClip;
public var moreGamesButton:SimpleButton;
public function Title(){
if (Object(parent).currentFrame == 5){
return;
};
startButton.addEventListener(MouseEvent.CLICK, startButtonClicked);
arcadeButton.addEventListener(MouseEvent.CLICK, arcadeButtonClicked);
moreGamesButton.addEventListener(MouseEvent.CLICK, moreGamesButtonClicked);
startButton.addEventListener(MouseEvent.MOUSE_OVER, overClassic);
arcadeButton.addEventListener(MouseEvent.MOUSE_OVER, overArcade);
startButton.addEventListener(MouseEvent.MOUSE_OUT, outClassic);
arcadeButton.addEventListener(MouseEvent.MOUSE_OUT, outArcade);
this.addEventListener(MouseEvent.MOUSE_MOVE, mMove);
ClassicDescription.visible = false;
ArcadeDescription.visible = false;
}
private function overArcade(_arg1:MouseEvent):void{
ArcadeDescription.visible = true;
}
private function outArcade(_arg1:MouseEvent):void{
ArcadeDescription.visible = false;
}
private function overClassic(_arg1:MouseEvent):void{
ClassicDescription.visible = true;
}
private function outClassic(_arg1:MouseEvent):void{
ClassicDescription.visible = false;
}
private function startButtonClicked(_arg1:MouseEvent):void{
Object(parent).gotoInstructionsPage();
}
private function moreGamesButtonClicked(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://oceanbreezegames.com/index.php?PLATFORM=Browser"), "_blank");
}
private function arcadeButtonClicked(_arg1:MouseEvent):void{
Object(parent).gotoInstructionsPageArcade(true);
}
private function mMove(_arg1:MouseEvent):void{
ClassicDescription.x = _arg1.stageX;
ClassicDescription.y = _arg1.stageY;
ArcadeDescription.x = _arg1.stageX;
ArcadeDescription.y = _arg1.stageY;
}
}
}//package com.Standard
Section 22
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class AdLoader {
private static var cpmstarLoader:Loader;
public static function LoadAd(_arg1:int, _arg2:int):DisplayObject{
var cpmstarViewSWFUrl:String;
var poolid = _arg1;
var subpoolid = _arg2;
try {
Security.allowDomain("server.cpmstar.com");
cpmstarViewSWFUrl = "http://server.cpmstar.com/adviewas3.swf";
cpmstarLoader = new Loader();
cpmstarLoader.load(new URLRequest(((((cpmstarViewSWFUrl + "?poolid=") + poolid) + "&subpoolid=") + subpoolid)));
return (cpmstarLoader);
} catch(se:SecurityError) {
};
return (null);
}
}
}//package CPMStar
Section 23
//MochiScores (mochi.MochiScores)
package mochi {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi
Section 24
//MochiServices (mochi.MochiServices)
package mochi {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
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++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
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);
};
};
};
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function getVersion():String{
return ("1.31");
}
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 {
_listenChannel.close();
_rcvChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
return (_local2);
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
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 onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()});
_rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
_rcvChannel.connect(_rcvChannelName);
trace("connected!");
_connecting = false;
_connected = true;
_listenChannel.close();
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
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 (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) {
};
};
};
};
}
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");
_rcvChannelName = _arg1;
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
MochiServices.allowDomains(_gatewayURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_gatewayURL);
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain("*", "localhost");
_rcvChannel.allowInsecureDomain("*", "localhost");
_rcvChannel.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (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 connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 25
//LoaderBar_3 (Pobble_fla.LoaderBar_3)
package Pobble_fla {
import flash.display.*;
public dynamic class LoaderBar_3 extends MovieClip {
public var InnerBar:MovieClip;
}
}//package Pobble_fla
Section 26
//Text1_18 (Pobble_fla.Text1_18)
package Pobble_fla {
import flash.display.*;
public dynamic class Text1_18 extends MovieClip {
public function Text1_18(){
addFrameScript(0, frame1, 169, frame170);
}
function frame170(){
gotoAndStop(1);
}
function frame1(){
stop();
}
}
}//package Pobble_fla
Section 27
//TheIntro_6 (Pobble_fla.TheIntro_6)
package Pobble_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.filters.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class TheIntro_6 extends MovieClip {
public var pt:Point;
public var PG:MovieClip;
public var dMapFilter:DisplacementMapFilter;
public var box3SX:Number;
public var box3SY:Number;
public var t1Frame:Number;
public var fLoop:Boolean;
public var sc:SoundChannel;
public var pgTime:Number;
public var BackGround:MovieClip;
public var LogoRad:Number;
public var box2SX:Number;
public var box2SY:Number;
public var Text1:MovieClip;
public var bwRad:Number;
public var dt:Number;
public var map:MovieClip;
public var PleaseWait:MovieClip;
public var fwRad:Number;
public var BackWave:MovieClip;
public var FrontWave:MovieClip;
public var box1SY:Number;
public var box1SX:Number;
public var bmp:BitmapData;
public var mask_mc:MovieClip;
public var Logo:MovieClip;
public var wl:Sound;
public var filterArray:Array;
public var VisitOBG:MovieClip;
public var Box1:MovieClip;
public var Box3:MovieClip;
public var Time:Number;
public var Box2:MovieClip;
public function TheIntro_6(){
addFrameScript(0, frame1);
}
public function UpdateWarp(_arg1:Number){
dMapFilter.scaleX = (Math.cos(LogoRad) * 3.5);
dMapFilter.scaleY = (Math.sin(LogoRad) * 3.5);
LogoRad = (LogoRad + (2.5 * _arg1));
filterArray[0] = dMapFilter;
Logo.filters = filterArray;
}
public function visitOBG(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.oceanbreezegames.com/index.php?PLATFORM=Browser");
navigateToURL(_local2, "_blank");
}
public function onEnterFrame(_arg1:Event){
var _local2:Number;
_local2 = getTimer();
dt = ((_local2 - Time) / 1000);
Time = _local2;
if (fLoop){
dt = 0;
fLoop = false;
};
bwRad = (bwRad + dt);
BackWave.y = ((Math.sin(bwRad) * 6.5) + 454);
BackWave.x = ((-((Math.cos(fwRad) + Math.sin(fwRad))) * 4.5) + 316);
fwRad = (fwRad + (dt * 2));
FrontWave.x = ((Math.cos(fwRad) + (Math.sin(fwRad) * 10)) + 316);
FrontWave.y = ((Math.sin(fwRad) + (Math.cos(fwRad) * 3)) + 435);
Box1.x = (((Math.cos(fwRad) + Math.sin(fwRad)) * 2) + box1SX);
Box3.x = (((Math.cos(fwRad) + Math.sin(fwRad)) * 2) + box3SX);
Box1.y = ((-(Math.sin(bwRad)) * 3.5) + box1SY);
Box3.y = ((-(Math.sin(bwRad)) * 3.5) + box3SY);
Box2.x = ((Math.cos(fwRad) + (Math.sin(fwRad) * -4)) + box2SX);
Box2.y = ((Math.sin(fwRad) + (Math.cos(fwRad) * -1.5)) + box2SY);
Box1.rotation = (Math.cos(fwRad) * -4);
Box2.rotation = (Math.sin(fwRad) * -3.5);
Box3.rotation = (Math.cos(-(bwRad)) * 5);
t1Frame = (t1Frame + (dt * 24));
while (t1Frame > 1) {
Text1.nextFrame();
t1Frame = (t1Frame - 1);
};
pgTime = (pgTime - dt);
if (pgTime <= 1){
if (pgTime < 0){
pgTime = 0;
PleaseWait.visible = false;
};
PG.y = (422 + (pgTime * 75));
PleaseWait.alpha = pgTime;
};
UpdateWarp(dt);
}
public function continueToGame(_arg1:MouseEvent):void{
sc.stop();
Object(parent).play();
}
function frame1(){
dt = 0.1;
Time = 0;
bwRad = 0;
fwRad = 0;
box1SX = Box1.x;
box2SX = Box2.x;
box3SX = Box3.x;
box1SY = Box1.y;
box2SY = Box2.y;
box3SY = Box3.y;
t1Frame = 0;
pgTime = 3;
fLoop = true;
wl = new WaveLoop();
sc = wl.play(0, int.MAX_VALUE);
LogoRad = 0;
bmp = new BitmapData(270, 240);
map = new Filter();
bmp.draw(map);
pt = new Point(0, 0);
dMapFilter = new DisplacementMapFilter(bmp, pt, 1, 1, 4, 4, "wrap", 0, 0);
filterArray = new Array(dMapFilter);
Logo.filters = filterArray;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
PG.addEventListener(MouseEvent.CLICK, continueToGame);
PG.buttonMode = true;
PG.useHandCursor = true;
VisitOBG.addEventListener(MouseEvent.CLICK, visitOBG);
VisitOBG.buttonMode = true;
VisitOBG.useHandCursor = true;
}
}
}//package Pobble_fla
Section 28
//Ball1 (Ball1)
package {
import flash.display.*;
public dynamic class Ball1 extends MovieClip {
}
}//package
Section 29
//Ball2 (Ball2)
package {
import flash.display.*;
public dynamic class Ball2 extends MovieClip {
}
}//package
Section 30
//Ball3 (Ball3)
package {
import flash.display.*;
public dynamic class Ball3 extends MovieClip {
}
}//package
Section 31
//Ball4 (Ball4)
package {
import flash.display.*;
public dynamic class Ball4 extends MovieClip {
}
}//package
Section 32
//Ball5 (Ball5)
package {
import flash.display.*;
public dynamic class Ball5 extends MovieClip {
}
}//package
Section 33
//Ball6 (Ball6)
package {
import flash.display.*;
public dynamic class Ball6 extends MovieClip {
}
}//package
Section 34
//Ball7 (Ball7)
package {
import flash.display.*;
public dynamic class Ball7 extends MovieClip {
}
}//package
Section 35
//Filter (Filter)
package {
import flash.display.*;
public dynamic class Filter extends MovieClip {
}
}//package
Section 36
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.2");
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
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"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_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 _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
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.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, 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."));
};
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (!this.parent.parent){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 37
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 38
//obgcom (obgcom)
package {
import flash.display.*;
public dynamic class obgcom extends MovieClip {
}
}//package
Section 39
//SlideTrack (SlideTrack)
package {
import flash.display.*;
public dynamic class SlideTrack extends MovieClip {
}
}//package
Section 40
//soundGliss (soundGliss)
package {
import flash.media.*;
public dynamic class soundGliss extends Sound {
}
}//package
Section 41
//ThumbTracker (ThumbTracker)
package {
import flash.display.*;
public dynamic class ThumbTracker extends MovieClip {
}
}//package
Section 42
//WaveLoop (WaveLoop)
package {
import flash.media.*;
public dynamic class WaveLoop extends Sound {
}
}//package