Section 1
//MainTimeline (neoOrb_game_fla.MainTimeline)
package neoOrb_game_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var m_timeLeft:int;
public var COL_WIDTH:int;
public var watchBackBtn:Fred_btn;
public var m_quitMC:Quit_mc;
public var m_score:uint;
public var i:int;
public var NUM_COLORS:int;
public var SHRINK_SPEED;
public var quit_btn:Menu_btn;
public var skipBtn:Clicktoskip_btn;
public var m_isMute:Boolean;
public var m_animatingPieces:int;
public var m_sidePieces:Array;
public var m_isMusicPlaying:Boolean;
public var m_stage:int;
public var SIDE_START_X;
public var SIDE_START_Y;
public var clock_txt:TextField;
public var m_selectedPiece:Piece;
public var SCside_mc1:SCside_mc;
public var SIDE_COL_HEIGHT:int;
public var PIECES_LEFT:Array;
public var m_highScoreMC:Highscoreinput_mc;
public var okBtn:Ok_btn;
public var COL_HEIGHT:int;
public var COLS:int;
public var TOTAL_TIME:Array;
public var m_timer:Timer;
public var m_backSoundChannel:SoundChannel;
public var SIDE_HEIGHT;
public var m_quality:String;
public var storyBtn:Story_btn;
public var m_level:int;
public var level_txt:TextField;
public var HEIGHT:int;
public var score_txt:TextField;
public var m_pieces:Array;
public var START_X:int;
public var START_Y:int;
public var WIDTH:int;
public var orbsleft_txt:TextField;
public var m_soundClip:Soundclip_mc;
public var TEXT_COLOR:Array;
public var m_backgroundMusic:Sound;
public var fredLogoBtn:Fredlogo_btn;
public var ROWS:int;
public var m_chainCount:int;
public var SOUND_OFFSET:Array;
public var musicBtn:Music_btn;
public var m_piecesLeft:int;
public function MainTimeline(){
addFrameScript(0, frame1, 335, frame336, 349, frame350, 350, frame351, 351, frame352, 393, frame394, 405, frame406, 461, frame462, 493, frame494, 571, frame572, 4942, frame4943, 4946, frame4947);
}
function frame394(){
i = 0;
while (i < numChildren) {
if ((getChildAt(i) is Ok_btn)){
okBtn = Ok_btn(getChildAt(i));
break;
};
i++;
};
okBtn.addEventListener(MouseEvent.CLICK, NextStoryMode1);
}
public function ShowTransitionMovie():void{
var _local1:Transition_mc;
_local1 = new Transition_mc();
_local1.x = 250;
_local1.y = 241;
_local1.addEventListener(Event.ENTER_FRAME, ShowReadyGoMovie);
this.addChild(_local1);
this.setChildIndex(_local1, (this.numChildren - 1));
_local1.gotoAndPlay(1);
}
public function RemoveAllPieces(_arg1:Boolean, _arg2:Boolean):void{
var _local3:int;
var _local4:int;
var _local5:int;
_local3 = 0;
while (_local3 < ROWS) {
_local5 = 0;
while (_local5 < COLS) {
if (m_pieces[_local3][_local5] == null){
} else {
m_pieces[_local3][_local5].removeEventListener(MouseEvent.CLICK, ClickPiece);
if (_arg2){
if (m_pieces[_local3][_local5].hasEventListener(Event.ENTER_FRAME)){
m_pieces[_local3][_local5].removeEventListener(Event.ENTER_FRAME, OnRemovePieceEnterFrame);
m_pieces[_local3][_local5].removeEventListener(Event.ENTER_FRAME, OnMovePieceEnterFrame);
};
};
if (_arg1){
if (m_pieces[_local3][_local5].hasEventListener(Event.ENTER_FRAME)){
m_pieces[_local3][_local5].removeEventListener(Event.ENTER_FRAME, OnRemovePieceEnterFrame);
m_pieces[_local3][_local5].removeEventListener(Event.ENTER_FRAME, OnMovePieceEnterFrame);
};
this.removeChild(m_pieces[_local3][_local5]);
m_pieces[_local3][_local5] = null;
};
};
_local5++;
};
_local3++;
};
_local4 = 0;
while (_local4 < (ROWS - 1)) {
if (m_sidePieces[_local4] == null){
} else {
m_sidePieces[_local4].removeEventListener(MouseEvent.CLICK, ClickPiece);
if (_arg1){
if (m_sidePieces[_local4].hasEventListener(Event.ENTER_FRAME)){
m_sidePieces[_local4].removeEventListener(Event.ENTER_FRAME, OnMovePieceEnterFrame);
};
this.removeChild(m_sidePieces[_local4]);
m_sidePieces[_local4] = null;
};
};
_local4++;
};
}
public function GameOver():void{
var _local1:Gameover_mc;
var _local2:Backtomenu_btn;
var _local3:Highscore_btn;
var _local4:Continue2_btn;
RemoveAllPieces(false, true);
_local1 = new Gameover_mc();
_local1.name = "game_over_mc";
_local1.x = 270;
_local1.y = 125;
this.addChild(_local1);
this.setChildIndex(_local1, (this.numChildren - 1));
_local2 = new Backtomenu_btn();
_local2.name = "menuBtn";
_local2.x = 350;
_local2.y = 365;
_local2.addEventListener(MouseEvent.CLICK, QuitGame);
this.addChild(_local2);
this.setChildIndex(_local2, (this.numChildren - 1));
_local3 = new Highscore_btn();
_local3.name = "highscoreBtn";
_local3.x = 315;
_local3.y = 310;
_local3.addEventListener(MouseEvent.CLICK, ShowHighScore);
this.addChild(_local3);
this.setChildIndex(_local3, (this.numChildren - 1));
_local4 = new Continue2_btn();
_local4.name = "continue_btn";
_local4.x = 578;
_local4.y = 420;
_local4.addEventListener(MouseEvent.CLICK, RestartLevel);
this.addChild(_local4);
this.setChildIndex(_local4, (this.numChildren - 1));
if (m_isMusicPlaying){
m_backSoundChannel.stop();
m_isMusicPlaying = false;
};
}
public function StartStoryMode(_arg1:MouseEvent):void{
gotoAndPlay("storymode_start");
}
public function StartTimer(_arg1:Event){
var _local2:Readygo_mc;
var _local3:int;
_local2 = Readygo_mc(_arg1.target);
if (_local2.currentFrame == (_local2.totalFrames - 1)){
_local2.removeEventListener(Event.ENTER_FRAME, StartTimer);
this.removeChild(_local2);
ActivateClick();
m_timer = new Timer(1000);
m_timer.addEventListener(TimerEvent.TIMER, OnTimer);
m_timer.start();
if (!m_isMute){
_local3 = SOUND_OFFSET[(m_level - 1)];
m_backSoundChannel = m_backgroundMusic.play(_local3, int.MAX_VALUE);
m_isMusicPlaying = true;
};
};
}
public function OnMusicButtonClick(_arg1:MouseEvent):void{
if (((!((getChildByName("win_mc") == null))) || (!((getChildByName("game_over_mc") == null))))){
return;
};
if (!m_isMute){
m_backSoundChannel.stop();
m_isMusicPlaying = false;
m_isMute = true;
} else {
m_backSoundChannel = m_backgroundMusic.play(SOUND_OFFSET[(m_level - 1)], int.MAX_VALUE);
m_isMusicPlaying = true;
m_isMute = false;
};
}
public function NextLevel():void{
if (m_stage != TOTAL_TIME[0].length){
trace("Should not be here");
return;
};
RemoveAllPieces(true, false);
this.removeChild(this.getChildByName("win_mc"));
this.removeChild(this.getChildByName("next_btn"));
m_stage = 1;
m_level++;
StartGame(true);
}
public function ActivateClick(){
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = 0;
while (_local1 < ROWS) {
_local3 = 0;
while (_local3 < COLS) {
m_pieces[_local1][_local3].addEventListener(MouseEvent.CLICK, ClickPiece);
_local3++;
};
_local1++;
};
_local2 = 0;
while (_local2 < (ROWS - 1)) {
m_sidePieces[_local2].addEventListener(MouseEvent.CLICK, ClickPiece);
_local2++;
};
}
public function ClickPiece(_arg1:MouseEvent):void{
var _local2:Piece;
if (m_animatingPieces > 0){
return;
};
_local2 = Piece(_arg1.target);
if (m_selectedPiece == null){
_local2.gotoAndStop((_local2.currentFrame + NUM_COLORS));
m_selectedPiece = _local2;
return;
};
m_selectedPiece.gotoAndStop((m_selectedPiece.currentFrame - NUM_COLORS));
if (m_selectedPiece == _local2){
m_selectedPiece = null;
return;
};
if (m_selectedPiece.isSide == _local2.isSide){
_local2.gotoAndStop((_local2.currentFrame + NUM_COLORS));
m_selectedPiece = _local2;
return;
};
SwapPieces(m_selectedPiece, _local2);
m_selectedPiece = null;
}
public function NextStoryMode1(_arg1:MouseEvent):void{
gotoAndPlay("storymode_next01");
}
public function DisplayTime():void{
var _local1:int;
var _local2:int;
var _local3:String;
var _local4:String;
_local1 = Math.floor((m_timeLeft / 60));
_local2 = (m_timeLeft - (_local1 * 60));
_local3 = String(_local1);
if (_local1 < 10){
_local3 = ("0" + _local3);
};
_local4 = String(_local2);
if (_local2 < 10){
_local4 = ("0" + _local4);
};
clock_txt.text = ((_local3 + ":") + _local4);
if (m_timeLeft > 30){
clock_txt.textColor = 0xFFFFFF;
};
if (m_timeLeft <= 30){
clock_txt.textColor = 14074913;
};
if (m_timeLeft <= 10){
clock_txt.textColor = 16718362;
};
}
function frame1(){
fredLogoBtn.addEventListener(MouseEvent.CLICK, GoToFredSite);
}
public function EndEndingMovie(_arg1:Event):void{
var _local2:Ending_mc;
_local2 = Ending_mc(_arg1.target);
if (_local2.currentFrame == (_local2.totalFrames - 1)){
_local2.removeEventListener(Event.ENTER_FRAME, EndEndingMovie);
this.removeChild(_local2);
ShowHighScore(new MouseEvent(MouseEvent.CLICK));
};
}
public function InitPieces():void{
var _local1:int;
var _local2:Boolean;
var _local3:int;
var _local4:int;
var _local5:int;
m_pieces = new Array(ROWS);
_local1 = 0;
while (_local1 < ROWS) {
m_pieces[_local1] = new Array(COLS);
_local3 = 0;
while (_local3 < COLS) {
m_pieces[_local1][_local3] = MakeNewBoardPiece(_local1, _local3);
this.addChild(m_pieces[_local1][_local3]);
_local3++;
};
_local1++;
};
_local2 = true;
while (_local2) {
FindMatchingPieces();
_local2 = false;
_local4 = 0;
while (_local4 < ROWS) {
_local5 = 0;
while (_local5 < COLS) {
if (m_pieces[_local4][_local5].isMatch){
this.removeChild(m_pieces[_local4][_local5]);
m_pieces[_local4][_local5] = MakeNewBoardPiece(_local4, _local5);
this.addChild(m_pieces[_local4][_local5]);
_local2 = true;
};
_local5++;
};
_local4++;
};
};
InitSidePieces();
}
public function OnTimer(_arg1:TimerEvent):void{
m_timeLeft--;
if (m_timeLeft <= 0){
clock_txt.text = "00:00";
m_timer.stop();
GameOver();
} else {
DisplayTime();
};
}
public function WinStage():void{
var _local1:Youwin_mc;
var _local2:Continue_btn;
var _local3:Ending_mc;
if (m_timeLeft <= 0){
return;
};
if (m_isMusicPlaying){
m_backSoundChannel.stop();
m_isMusicPlaying = false;
};
RemoveAllPieces(false, false);
if (this.getChildByName("win_mc") != null){
this.setChildIndex(this.getChildByName("win_mc"), (this.numChildren - 1));
if (m_animatingPieces <= 0){
getChildByName("next_btn").addEventListener(MouseEvent.CLICK, NextStage);
};
return;
};
m_timer.stop();
if ((((m_level == TOTAL_TIME.length)) && ((m_stage == TOTAL_TIME[0].length)))){
trace("Won the entire game! Something happens here!");
if (this.getChildByName("ending_mc") != null){
return;
};
RemoveAllPieces(false, true);
_local3 = new Ending_mc();
_local3.name = "ending_mc";
_local3.x = 10;
_local3.y = 10;
_local3.addEventListener(Event.ENTER_FRAME, EndEndingMovie);
this.addChild(_local3);
this.setChildIndex(_local3, (this.numChildren - 1));
_local3.gotoAndPlay(0);
return;
};
_local1 = new Youwin_mc();
_local1.name = "win_mc";
_local1.x = 305;
_local1.y = 125;
this.addChild(_local1);
_local1.gotoAndPlay(1);
_local2 = new Continue_btn();
_local2.name = "next_btn";
_local2.x = 578;
_local2.y = 420;
this.addChild(_local2);
}
function frame406(){
stop();
}
function frame4943(){
stop();
gotoAndStop(1, "Game");
}
function frame4947(){
WIDTH = 380;
HEIGHT = 420;
COLS = 5;
ROWS = 6;
COL_WIDTH = (WIDTH / COLS);
COL_HEIGHT = (HEIGHT / ROWS);
START_X = 239;
START_Y = 55;
NUM_COLORS = 6;
SHRINK_SPEED = 20;
m_highScoreMC = null;
m_quitMC = null;
m_backgroundMusic = null;
m_isMusicPlaying = false;
m_isMute = false;
m_quality = StageQuality.BEST;
m_pieces = new Array(ROWS);
SIDE_START_X = 640;
SIDE_START_Y = 113;
SIDE_HEIGHT = 330;
SIDE_COL_HEIGHT = (SIDE_HEIGHT / (ROWS - 1));
m_sidePieces = new Array((ROWS - 1));
m_animatingPieces = 0;
m_selectedPiece = null;
SOUND_OFFSET = [750, 750, 750, 750, 300];
TEXT_COLOR = [3828781, 154519, 8730115, 3550114, 5311757];
TOTAL_TIME = [[120, 60, 60, 60, 60], [70, 70, 70, 80, 80], [100, 100, 100, 100, 100], [145, 145, 145, 145, 145], [200, 200, 200, 260, 270]];
PIECES_LEFT = [[40, 45, 50, 55, 60], [70, 80, 90, 100, 120], [150, 160, 170, 180, 200], [210, 220, 230, 240, 250], [300, 350, 400, 500, 600]];
m_level = 1;
m_stage = 1;
m_score = 0;
m_chainCount = -1;
EditRightClickMenu();
musicBtn.addEventListener(MouseEvent.CLICK, OnMusicButtonClick);
quit_btn.addEventListener(MouseEvent.CLICK, OnQuitButtonClick);
StartGame(true);
}
public function SubmitHighScore(_arg1:MouseEvent):void{
var _local2:URLVariables;
var _local3:URLRequest;
var _local4:URLLoader;
_local2 = new URLVariables();
_local2.user = m_highScoreMC.highscorename_txt.text;
_local2.score = String(m_score);
_local2.level = String(m_level);
_local2.stage = String(m_stage);
_local2.fookey = "FoO4Swf";
_local3 = new URLRequest();
_local3.url = "http://www.fredthemonkey.com/test4321/foo_db_foo.php";
_local3.data = _local2;
_local4 = new URLLoader();
_local4.addEventListener(IOErrorEvent.IO_ERROR, HandleIOError);
_local4.addEventListener(HTTPStatusEvent.HTTP_STATUS, HandleIOError);
_local4.addEventListener(SecurityErrorEvent.SECURITY_ERROR, HandleIOError);
_local4.load(_local3);
_local4.addEventListener(Event.COMPLETE, CompleteWriting);
}
public function OnMovePieceEnterFrame(_arg1:Event):void{
var _local2:Piece;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = Piece(_arg1.target);
_local3 = (_local2.targetx - _local2.x);
_local4 = (_local2.targety - _local2.y);
_local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
if (_local5 < 10){
_local2.x = _local2.targetx;
_local2.y = _local2.targety;
_local2.removeEventListener(Event.ENTER_FRAME, OnMovePieceEnterFrame);
m_animatingPieces--;
UpdateBoard(0);
} else {
_local2.x = (_local2.x + (_local3 * 0.5));
_local2.y = (_local2.y + (_local4 * 0.5));
};
}
public function InitSidePieces():void{
var _local1:int;
var _local2:Piece;
var _local3:int;
_local1 = 0;
while (_local1 < m_sidePieces.length) {
_local2 = new Piece();
_local3 = Math.round((Math.random() * NUM_COLORS));
_local2.x = SIDE_START_X;
_local2.y = (SIDE_START_Y + (_local1 * SIDE_COL_HEIGHT));
_local2.row = _local1;
_local2.isSide = true;
this.addChild(_local2);
_local2.gotoAndStop(_local3);
_local2.addEventListener(MouseEvent.MOUSE_OVER, OnMouseOver);
_local2.addEventListener(MouseEvent.MOUSE_OUT, OnMouseOut);
m_sidePieces[_local1] = _local2;
_local1++;
};
}
public function RestartLevel(_arg1:Event):void{
this.removeChild(this.getChildByName("game_over_mc"));
this.removeChild(this.getChildByName("menuBtn"));
this.removeChild(this.getChildByName("highscoreBtn"));
this.removeChild(this.getChildByName("continue_btn"));
trace("removing pieces");
RemoveAllPieces(true, false);
m_stage = 1;
m_score = 0;
StartGame(true);
}
public function QuitGame(_arg1:MouseEvent):void{
var _local2:Array;
var _local3:int;
if (m_isMusicPlaying){
m_backSoundChannel.stop();
m_isMusicPlaying = false;
};
RemoveAllPieces(true, false);
if (m_quitMC != null){
this.removeChild(m_quitMC);
m_quitMC = null;
};
m_timer.stop();
if (m_highScoreMC != null){
this.removeChild(m_highScoreMC);
m_highScoreMC = null;
};
_local2 = ["game_over_mc", "menuBtn", "highscoreBtn", "background_mc", "win_mc", "next_btn", "continue_btn"];
_local3 = 0;
while (_local3 < _local2.length) {
if (getChildByName(_local2[_local3]) != null){
this.removeChild(getChildByName(_local2[_local3]));
};
_local3++;
};
this.gotoAndPlay("title_screen", "Intro");
}
public function SwapPieces(_arg1:Piece, _arg2:Piece):void{
var _local3:Piece;
var _local4:Piece;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:int;
var _local10:Number;
var _local11:Number;
if (_arg1.isSide){
_local4 = _arg1;
_local3 = _arg2;
} else {
_local4 = _arg2;
_local3 = _arg1;
};
_local5 = _local4.row;
_local6 = _local4.x;
_local7 = _local4.y;
_local8 = _local3.row;
_local9 = _local3.col;
_local10 = _local3.x;
_local11 = _local3.y;
_local4.row = _local8;
_local4.col = _local9;
_local4.isSide = false;
_local4.scaleX = 1;
_local4.scaleY = 1;
m_pieces[_local8][_local9] = _local4;
_local3.row = _local5;
_local3.isSide = true;
_local3.scaleX = 1;
_local3.scaleY = 1;
m_sidePieces[_local5] = _local3;
MovePieceTo(_local4, _local10, _local11);
MovePieceTo(_local3, _local6, _local7);
}
public function ShowLevelMovie(){
var _local1:MovieClip;
var _local2:Gamebackground_mc;
switch (m_level){
case 1:
_local1 = new Level1tran_mc();
break;
case 2:
_local1 = new Level2tran_mc();
break;
case 3:
_local1 = new Level3tran_mc();
break;
case 4:
_local1 = new Level4tran_mc();
break;
case 5:
_local1 = new Level5tran_mc();
break;
default:
return;
};
if (this.getChildByName("background_mc") != null){
this.removeChild(this.getChildByName("background_mc"));
};
_local2 = new Gamebackground_mc();
_local2.name = "background_mc";
_local2.x = 10;
_local2.y = 10;
_local2.gotoAndStop(m_level);
this.addChild(_local2);
this.setChildIndex(_local2, 0);
score_txt.textColor = TEXT_COLOR[(m_level - 1)];
level_txt.textColor = TEXT_COLOR[(m_level - 1)];
score_txt.text = String(m_score);
orbsleft_txt.text = String(m_piecesLeft);
level_txt.text = ((String(m_level) + "-") + String(m_stage));
DisplayTime();
trace("Init pieces");
InitPieces();
_local1.name = "level_mc";
_local1.addEventListener(Event.ENTER_FRAME, OnStopLevelMovie);
this.addChild(_local1);
_local1.gotoAndPlay(0);
}
public function GoToFredSite(_arg1:MouseEvent):void{
var _local2:String;
var _local3:URLRequest;
_local2 = "http://www.FredtheMonkey.com";
_local3 = new URLRequest(_local2);
navigateToURL(_local3);
}
public function OnRemovePieceEnterFrame(_arg1:Event){
var _local2:Piece;
_local2 = Piece(_arg1.target);
if ((((_local2.width < SHRINK_SPEED)) && ((_local2.height < SHRINK_SPEED)))){
_local2.width = 0;
_local2.width = 0;
removeChild(_local2);
_local2.removeEventListener(Event.ENTER_FRAME, OnRemovePieceEnterFrame);
m_animatingPieces--;
UpdateBoard(1);
} else {
_local2.width = (_local2.width - SHRINK_SPEED);
_local2.height = (_local2.height - SHRINK_SPEED);
};
}
public function MovePieceTo(_arg1:Piece, _arg2:Number, _arg3:Number):void{
_arg1.targetx = _arg2;
_arg1.targety = _arg3;
_arg1.addEventListener(Event.ENTER_FRAME, OnMovePieceEnterFrame);
m_animatingPieces++;
}
public function HandleIOError(_arg1:Event):void{
trace("error has been thrown");
CompleteWriting(_arg1);
}
public function DropPieces():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Piece;
var _local7:int;
var _local8:Number;
var _local9:Piece;
if (m_animatingPieces > 0){
return;
};
_local1 = 0;
while (_local1 < COLS) {
_local2 = 0;
_local3 = (ROWS - 1);
for (;_local3 >= 0;_local3--) {
if (m_pieces[_local3][_local1] == null){
_local2++;
continue;
} else {
if (_local2 > 0){
_local6 = m_pieces[_local3][_local1];
_local7 = (_local6.row + _local2);
_local6.row = _local7;
m_pieces[_local6.row][_local1] = _local6;
_local8 = (START_Y + (_local7 * COL_HEIGHT));
MovePieceTo(_local6, _local6.x, _local8);
m_pieces[_local3][_local1] = null;
};
};
};
_local4 = (_local2 - 1);
while (_local4 >= 0) {
_local9 = MakeNewBoardPiece(_local4, _local1);
_local8 = _local9.y;
_local9.y = (_local8 - (_local2 * COL_HEIGHT));
m_pieces[_local4][_local1] = _local9;
_local9.addEventListener(MouseEvent.CLICK, ClickPiece);
addChild(_local9);
setChildIndex(_local9, 5);
MovePieceTo(_local9, _local9.x, _local8);
_local4--;
};
_local5 = 1;
if ((((m_chainCount > 0)) && ((m_chainCount <= 3)))){
_local5 = (_local5 + m_chainCount);
if (m_chainCount == 3){
_local5++;
};
};
m_score = (m_score + ((10 * _local2) * _local5));
score_txt.text = String(m_score);
m_piecesLeft = (m_piecesLeft - _local2);
orbsleft_txt.text = String(m_piecesLeft);
_local1++;
};
}
public function EditRightClickMenu():void{
var _local1:ContextMenu;
_local1 = new ContextMenu();
_local1.builtInItems.loop = false;
_local1.builtInItems.play = false;
_local1.builtInItems.print = false;
_local1.builtInItems.rewind = false;
_local1.builtInItems.save = false;
_local1.builtInItems.zoom = false;
this.contextMenu = _local1;
}
function frame336(){
storyBtn.addEventListener(MouseEvent.CLICK, StartStoryMode);
watchBackBtn.addEventListener(MouseEvent.CLICK, GoToBackStory);
}
public function CompleteWriting(_arg1:Event):void{
var _local2:String;
var _local3:String;
var _local4:URLRequest;
_local2 = m_highScoreMC.highscorename_txt.text;
_local3 = ("http://www.fredthemonkey.com/scores/neomain.php?user=" + _local2);
_local4 = new URLRequest(_local3);
navigateToURL(_local4);
QuitGame(new MouseEvent(MouseEvent.CLICK));
}
public function StartGame(_arg1:Boolean){
m_piecesLeft = PIECES_LEFT[(m_level - 1)][(m_stage - 1)];
m_timeLeft = TOTAL_TIME[(m_level - 1)][(m_stage - 1)];
m_backgroundMusic = new Underscore1_music();
if (_arg1){
if (m_level == 5){
m_backgroundMusic = new Underscore2_music();
};
ShowLevelMovie();
} else {
ShowTransitionMovie();
};
}
function frame572(){
skipBtn.addEventListener(MouseEvent.CLICK, SkipToGame);
}
function frame462(){
stop();
}
public function RemoveMatchingPieces():Boolean{
var _local1:Boolean;
var _local2:int;
var _local3:int;
_local1 = false;
_local2 = 0;
while (_local2 < ROWS) {
_local3 = 0;
while (_local3 < COLS) {
if (m_pieces[_local2][_local3].isMatch){
m_pieces[_local2][_local3].addEventListener(Event.ENTER_FRAME, OnRemovePieceEnterFrame);
m_pieces[_local2][_local3] = null;
m_animatingPieces++;
_local1 = true;
};
_local3++;
};
_local2++;
};
return (_local1);
}
public function ShowHighScore(_arg1:MouseEvent):void{
m_highScoreMC = new Highscoreinput_mc();
m_highScoreMC.x = 250;
m_highScoreMC.y = 120;
m_highScoreMC.submitBtn.addEventListener(MouseEvent.CLICK, SubmitHighScore);
this.addChild(m_highScoreMC);
this.setChildIndex(m_highScoreMC, (this.numChildren - 1));
}
public function UpdateBoard(_arg1:int):void{
if (m_animatingPieces > 0){
return;
};
if (m_timeLeft <= 0){
return;
};
if (_arg1 == 0){
FindMatchingPieces();
if (RemoveMatchingPieces()){
m_chainCount++;
if (m_chainCount == 0){
m_soundClip.gotoAndPlay("sound1");
} else {
if (m_chainCount == 1){
m_soundClip.gotoAndPlay("sound2");
} else {
if (m_chainCount == 2){
m_soundClip.gotoAndPlay("sound3");
} else {
if (m_chainCount >= 3){
m_soundClip.gotoAndPlay("sound4");
};
};
};
};
} else {
if (m_chainCount == 0){
SCside_mc1.gotoAndPlay("SCgood1");
};
if (m_chainCount == 1){
SCside_mc1.gotoAndPlay("SCgood3");
} else {
if (m_chainCount == 2){
SCside_mc1.gotoAndPlay("SCgood2");
} else {
if (m_chainCount >= 3){
SCside_mc1.gotoAndPlay("SCflip");
};
};
};
m_chainCount = -1;
if (m_piecesLeft <= 0){
orbsleft_txt.text = "0";
WinStage();
return;
};
};
};
if (_arg1 == 1){
DropPieces();
if (m_chainCount > 0){
m_piecesLeft = (m_piecesLeft - (m_chainCount + 1));
if (m_chainCount >= 3){
m_piecesLeft--;
};
orbsleft_txt.text = String(m_piecesLeft);
};
if (m_piecesLeft <= 0){
orbsleft_txt.text = "0";
WinStage();
};
};
}
function frame350(){
stop();
}
function frame352(){
stop();
}
public function OnMouseOut(_arg1:Event):void{
var _local2:Piece;
if (m_animatingPieces > 0){
return;
};
_local2 = Piece(_arg1.target);
_local2.scaleX = 1;
_local2.scaleY = 1;
}
public function OnQPressed(_arg1:KeyboardEvent):void{
trace(("q pressed? " + _arg1.charCode));
if (m_quality == StageQuality.BEST){
m_quality = StageQuality.MEDIUM;
} else {
if (m_quality == StageQuality.MEDIUM){
m_quality = StageQuality.LOW;
} else {
if (m_quality == StageQuality.LOW){
m_quality = StageQuality.BEST;
};
};
};
trace(("quality: " + m_quality));
stage.quality = m_quality;
}
function frame351(){
stop();
}
public function OnStopLevelMovie(_arg1:Event):void{
var _local2:MovieClip;
_local2 = MovieClip(_arg1.target);
if (_local2.currentFrame == (_local2.totalFrames - 1)){
_local2.removeEventListener(Event.ENTER_FRAME, OnStopLevelMovie);
this.removeChild(_local2);
ShowReadyGoMovie(new Event(Event.ENTER_FRAME));
};
}
public function OnQuitButtonClick(_arg1:MouseEvent):void{
if (m_quitMC != null){
return;
};
m_quitMC = new Quit_mc();
m_quitMC.name = "quit_mc";
m_quitMC.x = 250;
m_quitMC.y = 120;
m_quitMC.yesquit_btn.addEventListener(MouseEvent.CLICK, QuitGame);
m_quitMC.noquit_btn.addEventListener(MouseEvent.CLICK, NoQuitGame);
this.addChild(m_quitMC);
this.setChildIndex(m_quitMC, (this.numChildren - 1));
m_quitMC.gotoAndPlay(0);
}
public function SkipToGame(_arg1:MouseEvent):void{
gotoAndStop(1, "Game");
}
public function NextStage(_arg1:MouseEvent):void{
if (m_stage == 5){
NextLevel();
return;
};
m_stage++;
StartGame(false);
}
public function ShowReadyGoMovie(_arg1:Event):void{
var _local2:Transition_mc;
var _local3:Readygo_mc;
_local2 = Transition_mc(_arg1.target);
if (((!((_local2 == null))) && ((_local2.currentFrame == 6)))){
if (m_stage > 1){
this.removeChild(this.getChildByName("win_mc"));
this.removeChild(this.getChildByName("next_btn"));
RemoveAllPieces(true, false);
};
score_txt.text = String(m_score);
orbsleft_txt.text = String(m_piecesLeft);
level_txt.text = ((String(m_level) + "-") + String(m_stage));
DisplayTime();
InitPieces();
if (_local2 != null){
setChildIndex(_local2, (this.numChildren - 1));
};
};
if ((((_local2 == null)) || ((_local2.currentFrame == (_local2.totalFrames - 1))))){
if (_local2 != null){
_local2.removeEventListener(Event.ENTER_FRAME, ShowReadyGoMovie);
this.removeChild(_local2);
};
_local3 = new Readygo_mc();
_local3.name = "readygo_mc";
_local3.x = 301;
_local3.y = 245;
_local3.addEventListener(Event.ENTER_FRAME, StartTimer);
this.addChild(_local3);
_local3.gotoAndPlay(1);
};
}
function frame494(){
stop();
}
public function OnMouseOver(_arg1:Event):void{
var _local2:Piece;
if (m_animatingPieces > 0){
return;
};
_local2 = Piece(_arg1.target);
_local2.scaleX = 1.05;
_local2.scaleY = 1.05;
}
public function FindMatchingPieces():void{
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = 0;
while (_local1 < ROWS) {
_local2 = 0;
while (_local2 < COLS) {
_local3 = m_pieces[_local1][_local2].currentFrame;
m_pieces[_local1][_local2].isMatch = false;
if ((((((_local2 > 1)) && ((m_pieces[_local1][(_local2 - 1)].currentFrame == _local3)))) && ((m_pieces[_local1][(_local2 - 2)].currentFrame == _local3)))){
m_pieces[_local1][_local2].isMatch = true;
};
if ((((((_local2 > 0)) && ((m_pieces[_local1][(_local2 - 1)].currentFrame == _local3)))) && ((((_local2 < (COLS - 1))) && ((m_pieces[_local1][(_local2 + 1)].currentFrame == _local3)))))){
m_pieces[_local1][_local2].isMatch = true;
};
if ((((((_local2 < (COLS - 2))) && ((m_pieces[_local1][(_local2 + 1)].currentFrame == _local3)))) && ((m_pieces[_local1][(_local2 + 2)].currentFrame == _local3)))){
m_pieces[_local1][_local2].isMatch = true;
};
if ((((((_local1 > 1)) && ((m_pieces[(_local1 - 1)][_local2].currentFrame == _local3)))) && ((m_pieces[(_local1 - 2)][_local2].currentFrame == _local3)))){
m_pieces[_local1][_local2].isMatch = true;
};
if ((((((_local1 > 0)) && ((m_pieces[(_local1 - 1)][_local2].currentFrame == _local3)))) && ((((_local1 < (ROWS - 1))) && ((m_pieces[(_local1 + 1)][_local2].currentFrame == _local3)))))){
m_pieces[_local1][_local2].isMatch = true;
};
if ((((((_local1 < (ROWS - 2))) && ((m_pieces[(_local1 + 1)][_local2].currentFrame == _local3)))) && ((m_pieces[(_local1 + 2)][_local2].currentFrame == _local3)))){
m_pieces[_local1][_local2].isMatch = true;
};
_local2++;
};
_local1++;
};
}
public function NoQuitGame(_arg1:MouseEvent):void{
this.removeChild(m_quitMC);
m_quitMC = null;
}
public function GoToBackStory(_arg1:MouseEvent):void{
var _local2:String;
var _local3:URLRequest;
_local2 = "http://www.FredtheMonkey.com/index.php?option=com_content&task=view&id=147&itemId=49";
_local3 = new URLRequest(_local2);
navigateToURL(_local3);
}
public function MakeNewBoardPiece(_arg1:int, _arg2:int):Piece{
var _local3:Piece;
var _local4:int;
_local3 = new Piece();
_local4 = Math.floor(((Math.random() * NUM_COLORS) + 1));
if (_local4 > NUM_COLORS){
_local4 = NUM_COLORS;
};
_local3.x = (START_X + (_arg2 * COL_WIDTH));
_local3.y = (START_Y + (_arg1 * COL_HEIGHT));
_local3.row = _arg1;
_local3.col = _arg2;
_local3.isSide = false;
_local3.gotoAndStop(_local4);
_local3.addEventListener(MouseEvent.MOUSE_OVER, OnMouseOver);
_local3.addEventListener(MouseEvent.MOUSE_OUT, OnMouseOut);
return (_local3);
}
}
}//package neoOrb_game_fla
Section 2
//menuorbOver_35 (neoOrb_game_fla.menuorbOver_35)
package neoOrb_game_fla {
import flash.display.*;
public dynamic class menuorbOver_35 extends MovieClip {
public function menuorbOver_35(){
addFrameScript(14, frame15);
}
function frame15(){
stop();
}
}
}//package neoOrb_game_fla
Section 3
//scpopup_5 (neoOrb_game_fla.scpopup_5)
package neoOrb_game_fla {
import flash.display.*;
public dynamic class scpopup_5 extends MovieClip {
public function scpopup_5(){
addFrameScript(47, frame48);
}
function frame48(){
stop();
}
}
}//package neoOrb_game_fla
Section 4
//stageasWhole_27 (neoOrb_game_fla.stageasWhole_27)
package neoOrb_game_fla {
import flash.display.*;
import flash.text.*;
public dynamic class stageasWhole_27 extends MovieClip {
public var level_txt:TextField;
public var score_txt:TextField;
public var orbsleft_txt:TextField;
public var clock_txt:TextField;
}
}//package neoOrb_game_fla
Section 5
//subedtitle_17 (neoOrb_game_fla.subedtitle_17)
package neoOrb_game_fla {
import flash.display.*;
public dynamic class subedtitle_17 extends MovieClip {
public function subedtitle_17(){
addFrameScript(55, frame56);
}
function frame56(){
stop();
}
}
}//package neoOrb_game_fla
Section 6
//Backlevel1_mc (Backlevel1_mc)
package {
import flash.display.*;
public dynamic class Backlevel1_mc extends MovieClip {
}
}//package
Section 7
//Backlevel2_mc (Backlevel2_mc)
package {
import flash.display.*;
public dynamic class Backlevel2_mc extends MovieClip {
}
}//package
Section 8
//Backlevel3_mc (Backlevel3_mc)
package {
import flash.display.*;
public dynamic class Backlevel3_mc extends MovieClip {
}
}//package
Section 9
//Backlevel4_mc (Backlevel4_mc)
package {
import flash.display.*;
public dynamic class Backlevel4_mc extends MovieClip {
}
}//package
Section 10
//Backlevel5_mc (Backlevel5_mc)
package {
import flash.display.*;
public dynamic class Backlevel5_mc extends MovieClip {
}
}//package
Section 11
//Backtomenu_btn (Backtomenu_btn)
package {
import flash.display.*;
public dynamic class Backtomenu_btn extends SimpleButton {
}
}//package
Section 12
//Clicktoskip_btn (Clicktoskip_btn)
package {
import flash.display.*;
public dynamic class Clicktoskip_btn extends SimpleButton {
}
}//package
Section 13
//Continue_btn (Continue_btn)
package {
import flash.display.*;
public dynamic class Continue_btn extends SimpleButton {
}
}//package
Section 14
//Continue2_btn (Continue2_btn)
package {
import flash.display.*;
public dynamic class Continue2_btn extends SimpleButton {
}
}//package
Section 15
//Ending_mc (Ending_mc)
package {
import flash.display.*;
public dynamic class Ending_mc extends MovieClip {
public function Ending_mc(){
addFrameScript(3792, frame3793);
}
function frame3793(){
stop();
}
}
}//package
Section 16
//Fred_btn (Fred_btn)
package {
import flash.display.*;
public dynamic class Fred_btn extends SimpleButton {
}
}//package
Section 17
//Fredlogo_btn (Fredlogo_btn)
package {
import flash.display.*;
public dynamic class Fredlogo_btn extends SimpleButton {
}
}//package
Section 18
//fredlogo_mc (fredlogo_mc)
package {
import flash.display.*;
public dynamic class fredlogo_mc extends MovieClip {
}
}//package
Section 19
//Gamebackground_mc (Gamebackground_mc)
package {
import flash.display.*;
public dynamic class Gamebackground_mc extends MovieClip {
public function Gamebackground_mc(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 20
//Gameover_mc (Gameover_mc)
package {
import flash.display.*;
public dynamic class Gameover_mc extends MovieClip {
}
}//package
Section 21
//Highscore_btn (Highscore_btn)
package {
import flash.display.*;
public dynamic class Highscore_btn extends SimpleButton {
}
}//package
Section 22
//Highscoreinput_mc (Highscoreinput_mc)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Highscoreinput_mc extends MovieClip {
public var highscorename_txt:TextField;
public var submitBtn:Submit_btn;
}
}//package
Section 23
//Level1tran_mc (Level1tran_mc)
package {
import flash.display.*;
public dynamic class Level1tran_mc extends MovieClip {
public function Level1tran_mc(){
addFrameScript(160, frame161);
}
function frame161(){
stop();
}
}
}//package
Section 24
//Level2tran_mc (Level2tran_mc)
package {
import flash.events.*;
import flash.display.*;
public dynamic class Level2tran_mc extends MovieClip {
public var skipBtn2:Clicktoskip_btn;
public function Level2tran_mc(){
addFrameScript(13, frame14, 1089, frame1090);
}
function frame14(){
skipBtn2.addEventListener(MouseEvent.CLICK, skip2);
}
function frame1090(){
stop();
}
public function skip2(_arg1:MouseEvent):void{
gotoAndPlay("level2skipped");
}
}
}//package
Section 25
//Level3tran_mc (Level3tran_mc)
package {
import flash.events.*;
import flash.display.*;
public dynamic class Level3tran_mc extends MovieClip {
public var skipBtn3:Clicktoskip_btn;
public function Level3tran_mc(){
addFrameScript(16, frame17, 1227, frame1228);
}
function frame1228(){
stop();
}
function frame17(){
skipBtn3.addEventListener(MouseEvent.CLICK, skip3);
}
public function skip3(_arg1:MouseEvent):void{
gotoAndPlay("level3skipped");
}
}
}//package
Section 26
//Level4tran_mc (Level4tran_mc)
package {
import flash.events.*;
import flash.display.*;
public dynamic class Level4tran_mc extends MovieClip {
public var skipBtn4:Clicktoskip_btn;
public function Level4tran_mc(){
addFrameScript(15, frame16, 1142, frame1143);
}
function frame16(){
skipBtn4.addEventListener(MouseEvent.CLICK, skip4);
}
public function skip4(_arg1:MouseEvent):void{
gotoAndPlay("level4skipped");
}
function frame1143(){
stop();
}
}
}//package
Section 27
//Level5tran_mc (Level5tran_mc)
package {
import flash.events.*;
import flash.display.*;
public dynamic class Level5tran_mc extends MovieClip {
public var skipBtn5:Clicktoskip_btn;
public function Level5tran_mc(){
addFrameScript(15, frame16, 809, frame810);
}
function frame16(){
skipBtn5.addEventListener(MouseEvent.CLICK, skip5);
}
public function skip5(_arg1:MouseEvent):void{
gotoAndPlay("level5skipped");
}
function frame810(){
stop();
}
}
}//package
Section 28
//Menu_btn (Menu_btn)
package {
import flash.display.*;
public dynamic class Menu_btn extends SimpleButton {
}
}//package
Section 29
//Music_btn (Music_btn)
package {
import flash.display.*;
public dynamic class Music_btn extends SimpleButton {
}
}//package
Section 30
//Ok_btn (Ok_btn)
package {
import flash.display.*;
public dynamic class Ok_btn extends SimpleButton {
}
}//package
Section 31
//Piece (Piece)
package {
import flash.display.*;
public dynamic class Piece extends MovieClip {
}
}//package
Section 32
//Quit_mc (Quit_mc)
package {
import flash.display.*;
public dynamic class Quit_mc extends MovieClip {
public var noquit_btn:Quitno_btn;
public var yesquit_btn:Quityes_btn;
}
}//package
Section 33
//Quitno_btn (Quitno_btn)
package {
import flash.display.*;
public dynamic class Quitno_btn extends SimpleButton {
}
}//package
Section 34
//Quityes_btn (Quityes_btn)
package {
import flash.display.*;
public dynamic class Quityes_btn extends SimpleButton {
}
}//package
Section 35
//Readygo_mc (Readygo_mc)
package {
import flash.display.*;
public dynamic class Readygo_mc extends MovieClip {
public function Readygo_mc(){
addFrameScript(55, frame56);
}
function frame56(){
stop();
}
}
}//package
Section 36
//SCside_mc (SCside_mc)
package {
import flash.display.*;
public dynamic class SCside_mc extends MovieClip {
public function SCside_mc(){
addFrameScript(3, frame4, 65, frame66, 86, frame87, 105, frame106, 144, frame145);
}
function frame87(){
gotoAndPlay(1);
}
function frame106(){
gotoAndPlay(1);
}
function frame4(){
gotoAndPlay(1);
}
function frame145(){
gotoAndPlay(1);
}
function frame66(){
gotoAndPlay(1);
}
}
}//package
Section 37
//Soundclip_mc (Soundclip_mc)
package {
import flash.display.*;
public dynamic class Soundclip_mc extends MovieClip {
public function Soundclip_mc(){
addFrameScript(0, frame1, 14, frame15, 27, frame28, 39, frame40, 52, frame53);
}
function frame15(){
stop();
}
function frame1(){
stop();
}
function frame28(){
stop();
}
function frame40(){
stop();
}
function frame53(){
stop();
}
}
}//package
Section 38
//Story_btn (Story_btn)
package {
import flash.display.*;
public dynamic class Story_btn extends SimpleButton {
}
}//package
Section 39
//Submit_btn (Submit_btn)
package {
import flash.display.*;
public dynamic class Submit_btn extends SimpleButton {
}
}//package
Section 40
//Transition_mc (Transition_mc)
package {
import flash.display.*;
public dynamic class Transition_mc extends MovieClip {
public function Transition_mc(){
addFrameScript(15, frame16);
}
function frame16(){
stop();
}
}
}//package
Section 41
//Underscore1_music (Underscore1_music)
package {
import flash.media.*;
public dynamic class Underscore1_music extends Sound {
}
}//package
Section 42
//Underscore2_music (Underscore2_music)
package {
import flash.media.*;
public dynamic class Underscore2_music extends Sound {
}
}//package
Section 43
//Youwin_mc (Youwin_mc)
package {
import flash.display.*;
public dynamic class Youwin_mc extends MovieClip {
public function Youwin_mc(){
addFrameScript(47, frame48);
}
function frame48(){
gotoAndPlay("21");
}
}
}//package