Section 1
//Game (com.novelgames.flashgames.common.Game)
package com.novelgames.flashgames.common {
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.novelgames.flashgames.common
Section 2
//Instructions (com.novelgames.flashgames.common.Instructions)
package com.novelgames.flashgames.common {
import flash.events.*;
import flash.display.*;
public class Instructions extends MovieClip {
public var startButton:SimpleButton;
private var shownFromGame:Boolean;
public function Instructions(_arg1:Boolean=false){
this.shownFromGame = _arg1;
startButton.addEventListener(MouseEvent.CLICK, startButtonClicked);
}
private function startButtonClicked(_arg1:MouseEvent):void{
if (!shownFromGame){
Object(parent).gotoGamePage();
} else {
Object(parent).hideInstructionsFromGame();
};
}
}
}//package com.novelgames.flashgames.common
Section 3
//InstructionsButton (com.novelgames.flashgames.common.InstructionsButton)
package com.novelgames.flashgames.common {
import flash.events.*;
import flash.display.*;
public class InstructionsButton extends MovieClip {
public function InstructionsButton(){
super();
this.buttonMode = true;
this.addEventListener(MouseEvent.CLICK, function ():void{
Object(parent.parent).showInstructionsFromGame();
});
}
}
}//package com.novelgames.flashgames.common
Section 4
//MainDevelopment (com.novelgames.flashgames.common.MainDevelopment)
package com.novelgames.flashgames.common {
import flash.events.*;
import flash.media.*;
import flash.display.*;
public class MainDevelopment extends MovieClip {
private var title:Title;
private var musicGameSoundChannel:SoundChannel;
private var titleIndex:int;
private var instructions:Instructions;
private var musicGame:Sound;
private var game:Game;
public function MainDevelopment(){
this.addEventListener(Event.ENTER_FRAME, checkTitle);
}
protected function getMusicGame():Sound{
return (null);
}
public function hideInstructionsFromGame():void{
this.removeChild(instructions);
instructions = null;
game.visible = true;
game.unpause();
}
public function showInstructionsFromGame():void{
game.pause();
game.visible = false;
instructions = new Instructions(true);
this.addChildAt(instructions, (titleIndex + 1));
}
public function gotoGamePage():void{
Game.gameStage = stage;
removePage();
game = getGame();
this.addChildAt(game, titleIndex);
musicGame = getMusicGame();
musicGameSoundChannel = musicGame.play(0, int.MAX_VALUE);
}
private function checkTitle(_arg1:Event):void{
if (!(title = getTitle())){
return;
};
this.removeEventListener(Event.ENTER_FRAME, checkTitle);
stop();
titleIndex = this.getChildIndex(title);
}
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():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;
};
if (musicGame){
musicGameSoundChannel.stop();
musicGame = null;
musicGameSoundChannel = null;
};
}
protected function getTitle():Title{
return (null);
}
}
}//package com.novelgames.flashgames.common
Section 5
//MuteButton (com.novelgames.flashgames.common.MuteButton)
package com.novelgames.flashgames.common {
import flash.events.*;
import flash.media.*;
import flash.display.*;
public class MuteButton extends MovieClip {
private var gameSoundTransform:SoundTransform;
public function MuteButton(){
if (SoundMixer.soundTransform.volume == 0){
showOff();
} else {
showOn();
};
this.addEventListener(MouseEvent.CLICK, buttonClicked);
this.buttonMode = true;
}
private function showOff():void{
gotoAndStop("off");
}
private function buttonClicked(_arg1:MouseEvent):void{
var _local2:SoundTransform;
_local2 = new SoundTransform();
if (SoundMixer.soundTransform.volume == 0){
_local2.volume = 1;
SoundMixer.soundTransform = _local2;
showOn();
} else {
_local2.volume = 0;
SoundMixer.soundTransform = _local2;
showOff();
};
}
private function showOn():void{
gotoAndStop("on");
}
}
}//package com.novelgames.flashgames.common
Section 6
//NewTimer (com.novelgames.flashgames.common.NewTimer)
package com.novelgames.flashgames.common {
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.novelgames.flashgames.common
Section 7
//Title (com.novelgames.flashgames.common.Title)
package com.novelgames.flashgames.common {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class Title extends MovieClip {
public var startButton:SimpleButton;
public function Title(){
startButton.addEventListener(MouseEvent.CLICK, startButtonClicked);
}
private function startButtonClicked(_arg1:MouseEvent):void{
Object(parent).gotoInstructionsPage();
}
private function moreGamesButtonClicked(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.novelgames.com"), "_blank");
}
private function highScoresButtonClicked(_arg1:MouseEvent):void{
Object(parent).showHighScores();
}
}
}//package com.novelgames.flashgames.common
Section 8
//Config (com.novelgames.flashgames.mahjongg.Config)
package com.novelgames.flashgames.mahjongg {
public class Config {
public static var DIMENSION_Y:Number = 8;
public static var TILE_THICKNESS:Number = 4;
public static var SCORE_PERSECOND:Number = 10;
public static var SCORE_BASE:Number = 10000;
public static var HINT_PUNISHMENT:Number = 60;
public static var FLOORNO:Number = 5;
public static var FLOORS:Array = ["011111111111100000111111110000001111111111000111111111111100011111111111111001111111111000000111111110000011111111111100", "000000000000000000011111100000000011111100000000011111100000000011111100000000011111100000000011111100000000000000000000", "000000000000000000000000000000000001111000000000001111000000000001111000000000001111000000000000000000000000000000000000", "000000000000000000000000000000000000000000000000000110000000000000110000000000000000000000000000000000000000000000000000", "000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000"];
public static var MESSAGE_GAMEOVERTIME:Number = 1000;
public static var TILE_INFOS:Array = [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3], [4, 4, 4, 4], [5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8], [9, 9, 9, 9], [10, 10, 10, 10], [11, 11, 11, 11], [12, 12, 12, 12], [13, 13, 13, 13], [14, 14, 14, 14], [15, 15, 15, 15], [16, 16, 16, 16], [17, 17, 17, 17], [18, 18, 18, 18], [19, 19, 19, 19], [20, 20, 20, 20], [21, 21, 21, 21], [22, 22, 22, 22], [23, 23, 23, 23], [24, 24, 24, 24], [25, 25, 25, 25], [26, 26, 26, 26], [27, 27, 27, 27], [28, 28, 28, 28], [29, 29, 29, 29], [30, 30, 30, 30], [31, 31, 31, 31], [32, 32, 32, 32], [33, 33, 33, 33], [34, 34, 34, 34], [35, 36, 37, 38], [39, 40, 41, 42]];
public static var TILE_WIDTH:Number = 31;
public static var TILE_HEIGHT:Number = 46;
public static var DIMENSION_X:Number = 15;
}
}//package com.novelgames.flashgames.mahjongg
Section 9
//EndDialog (com.novelgames.flashgames.mahjongg.EndDialog)
package com.novelgames.flashgames.mahjongg {
import flash.events.*;
import flash.display.*;
public class EndDialog extends MovieClip {
private var messagePlayAgain:MessagePlayAgain;
public function EndDialog(){
gotoAndStop("hide");
}
public function showGameOver():void{
gotoAndStop("gameOver");
}
public function showPlayAgain():void{
gotoAndStop("playAgain");
messagePlayAgain = new MessagePlayAgain();
messagePlayAgain.playAgainButton.addEventListener(MouseEvent.CLICK, playAgainButtonClicked);
messagePlayAgain.homeButton.addEventListener(MouseEvent.CLICK, homeButtonClicked);
messagePlayAgain.playAgainSameTilesButton.addEventListener(MouseEvent.CLICK, playAgainSameTilesButtonClicked);
addChild(messagePlayAgain);
}
private function playAgainButtonClicked(_arg1:MouseEvent):void{
Object(parent.parent).gotoGamePage();
}
public function hide():void{
if (messagePlayAgain){
this.removeChild(messagePlayAgain);
messagePlayAgain = null;
};
gotoAndStop("hide");
}
private function playAgainSameTilesButtonClicked(_arg1:MouseEvent):void{
Object(parent).restart(null);
}
public function showGameWin():void{
gotoAndStop("gameWin");
}
private function homeButtonClicked(_arg1:MouseEvent):void{
Object(parent.parent).gotoTitlePage();
}
}
}//package com.novelgames.flashgames.mahjongg
Section 10
//Game (com.novelgames.flashgames.mahjongg.Game)
package com.novelgames.flashgames.mahjongg {
import flash.events.*;
import com.novelgames.flashgames.common.*;
import flash.media.*;
import flash.utils.*;
import flash.display.*;
import flash.text.*;
public class Game extends Game {
public var endDialog:EndDialog;
private var soundGameOver:Sound;
public var restartButton:SimpleButton;
private var gameStarted:Boolean;
public var secondsText:TextField;
private var soundTile:Sound;
private var soundWin:Sound;
public var hintButton:SimpleButton;
private var __seconds:Number;
public var minutesText:TextField;
private var __score:Number;
private var tilesReal:Array;
private var tilesRemovable:Array;
public var scoreText:TextField;
private var __minutes:Number;
private var beginTime:Number;
private var timer:Timer;
public var selectDialog:SelectDialog;
private var tiles:Array;
public var tilesHolder:MovieClip;
private var soundWrong:Sound;
private var selectedTile:Tile;
private var soundMatch:Sound;
public function Game(){
soundTile = new SoundTile();
soundMatch = new SoundMatch();
soundWrong = new SoundWrong();
soundGameOver = new SoundGameOver();
soundWin = new SoundWin();
timer = new NewTimer(1, 0);
timer.addEventListener(TimerEvent.TIMER, onTime);
timer.start();
}
public function restart(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = 0;
while (_local2 < tilesReal.length) {
tilesReal[_local2].visible = true;
tilesReal[_local2].gotoAndStop("normal");
_local2++;
};
minutes = 0;
seconds = 0;
selectedTile = null;
gameStarted = true;
beginTime = NewTimer.getTimer();
endDialog.hide();
restartButton.visible = true;
hintButton.visible = true;
}
private function showPlayAgain(_arg1:TimerEvent):void{
Object(parent).showEnterHighScore(score);
endDialog.showPlayAgain();
}
private function getTileTypesPairs():Array{
var _local1:Number;
var _local2:Number;
var _local3:Object;
var _local4:Array;
var _local5:Object;
_local4 = new Array();
_local1 = 0;
while (_local1 < Config.TILE_INFOS.length) {
_local2 = 0;
while (_local2 < Config.TILE_INFOS[_local1].length) {
_local5 = {type:_local1, index0:_local2, index1:(_local2 + 1)};
_local4.push(_local5);
_local2 = (_local2 + 2);
};
_local1++;
};
_local1 = 0;
while (_local1 < _local4.length) {
_local2 = Math.floor((Math.random() * _local4.length));
_local3 = _local4[_local1];
_local4[_local1] = _local4[_local2];
_local4[_local2] = _local3;
_local1++;
};
return (_local4);
}
private function getPutPair():Array{
var _local1:Array;
var _local2:int;
if (tilesRemovable.length < 2){
return (null);
};
_local1 = new Array();
_local1[0] = tilesRemovable[Math.floor((Math.random() * tilesRemovable.length))];
do {
_local1[1] = tilesRemovable[Math.floor((Math.random() * tilesRemovable.length))];
} while (_local1[0] == _local1[1]);
return (_local1);
}
public function clickTile(_arg1:Tile):void{
if (!gameStarted){
return;
};
if (!tileIsRemovable(_arg1)){
soundWrong.play();
return;
};
if (selectedTile == null){
selectedTile = _arg1;
selectedTile.gotoAndStop("selected");
soundTile.play();
} else {
if (selectedTile == _arg1){
selectedTile.gotoAndStop("normal");
selectedTile = null;
soundTile.play();
} else {
if (selectedTile.type != _arg1.type){
selectedTile.gotoAndStop("normal");
selectedTile = _arg1;
selectedTile.gotoAndStop("selected");
soundTile.play();
} else {
removeTile(selectedTile);
removeTile(_arg1);
selectedTile = null;
soundMatch.play();
if (!checkWin()){
checkGameOver();
};
};
};
};
}
public function get seconds():Number{
return (__seconds);
}
private function findPair():Array{
var _local1:Number;
var _local2:Number;
var _local3:Array;
var _local4:Array;
_local3 = new Array();
_local4 = new Array(2);
_local1 = 0;
while (_local1 < tilesReal.length) {
if (tileIsRemovable(tilesReal[_local1])){
_local3.push(tilesReal[_local1]);
_local2 = 0;
while (_local2 < (_local3.length - 1)) {
if (tilesReal[_local1].type == _local3[_local2].type){
_local4[0] = tilesReal[_local1];
_local4[1] = _local3[_local2];
return (_local4);
};
_local2++;
};
};
_local1++;
};
return (null);
}
private function gameWin():void{
var _local1:Timer;
gameStarted = false;
endDialog.showGameWin();
soundWin.play();
restartButton.visible = false;
hintButton.visible = false;
_local1 = new NewTimer(Config.MESSAGE_GAMEOVERTIME, 1);
_local1.addEventListener(TimerEvent.TIMER, showPlayAgain);
_local1.start();
}
public function get score():Number{
return (__score);
}
public function startPlay(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = 0;
selectDialog.visible = false;
tiles = new Array();
tilesReal = new Array();
tilesRemovable = new Array();
selectedTile = null;
gameStarted = false;
beginTime = 0;
minutes = 0;
seconds = 0;
score = Config.SCORE_BASE;
_local5 = 0;
_local3 = 0;
while (_local3 < Config.FLOORNO) {
_local4 = 0;
while (_local4 < Config.FLOORS[_local3].length) {
if (Config.FLOORS[_local3].substr(_local4, 1) == "1"){
tiles[_local2] = new Tile();
tiles[_local2].x = (((_local4 % Config.DIMENSION_X) * Config.TILE_WIDTH) - (_local3 * Config.TILE_THICKNESS));
tiles[_local2].y = ((Math.floor((_local4 / Config.DIMENSION_X)) * Config.TILE_HEIGHT) - (_local3 * Config.TILE_THICKNESS));
tiles[_local2].index = _local2;
tiles[_local2].type = -1;
tiles[_local2].setTileSet(_arg1);
tilesHolder.addChild(tiles[_local2]);
tilesReal[_local5] = tiles[_local2];
_local5++;
};
_local2++;
_local4++;
};
_local3++;
};
tiles[45].y = (tiles[45].y + (Config.TILE_HEIGHT / 2));
tiles[73].y = (tiles[73].y - (Config.TILE_HEIGHT / 2));
tiles[74].y = (tiles[74].y - (Config.TILE_HEIGHT / 2));
tiles[547].x = (tiles[547].x - (Config.TILE_WIDTH / 2));
tiles[547].y = (tiles[547].y - (Config.TILE_HEIGHT / 2));
restartButton.addEventListener(MouseEvent.CLICK, restart);
hintButton.addEventListener(MouseEvent.CLICK, showHint);
newGame();
}
public function get minutes():Number{
return (__minutes);
}
public function set seconds(_arg1:Number):void{
__seconds = _arg1;
secondsText.text = (((_arg1 < 10)) ? "0" : "" + _arg1.toString());
}
private function checkGameOver():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:Array;
_local3 = new Array();
_local1 = 0;
while (_local1 < tilesReal.length) {
if (tileIsRemovable(tilesReal[_local1])){
_local3.push(tilesReal[_local1]);
_local2 = 0;
while (_local2 < (_local3.length - 1)) {
if (tilesReal[_local1].type == _local3[_local2].type){
return (false);
};
_local2++;
};
};
_local1++;
};
gameOver();
return (true);
}
public function set score(_arg1:Number):void{
__score = _arg1;
scoreText.text = _arg1.toString();
}
private function showHint(_arg1:MouseEvent):void{
var _local2:Array;
_local2 = findPair();
if (_local2){
beginTime = (beginTime - (Config.HINT_PUNISHMENT * 1000));
_local2[0].gotoAndPlay("hint");
_local2[1].gotoAndPlay("hint");
};
}
private function tileIsRemovable(_arg1):Boolean{
var _local2:Number;
var _local3:Number;
_local2 = _arg1.index;
_local3 = (_local2 % Config.DIMENSION_X);
if (!_arg1.visible){
return (false);
};
if ((((((((((((_local3 > 0)) && ((_local3 < (Config.DIMENSION_X - 1))))) && (tiles[(_local2 - 1)]))) && (tiles[(_local2 - 1)].visible))) && (tiles[(_local2 + 1)]))) && (tiles[(_local2 + 1)].visible))){
return (false);
};
if ((((((_local2 < ((Config.DIMENSION_X * Config.DIMENSION_Y) * (Config.FLOORNO - 1)))) && (tiles[(_local2 + (Config.DIMENSION_X * Config.DIMENSION_Y))]))) && (tiles[(_local2 + (Config.DIMENSION_X * Config.DIMENSION_Y))].visible))){
return (false);
};
if ((((((_local2 == 61)) && (tiles[45].visible))) && (tiles[62].visible))){
return (false);
};
if ((((((_local2 == 73)) && (tiles[74].visible))) && (((tiles[57].visible) || (tiles[72].visible))))){
return (false);
};
if ((((((_local2 == 57)) && (tiles[56].visible))) && (tiles[73].visible))){
return (false);
};
if ((((_local2 == 411)) && (tiles[547].visible))){
return (false);
};
if ((((_local2 == 412)) && (tiles[547].visible))){
return (false);
};
if ((((_local2 == 426)) && (tiles[547].visible))){
return (false);
};
return (true);
}
private function onTime(_arg1:TimerEvent):void{
var _local2:Number;
if (!gameStarted){
return;
};
_local2 = (NewTimer.getTimer() - beginTime);
minutes = Math.floor((_local2 / 60000));
seconds = Math.floor(((_local2 % 60000) / 1000));
score = ((Config.SCORE_BASE - ((minutes * 60) * Config.SCORE_PERSECOND)) - (seconds * Config.SCORE_PERSECOND));
if (score < 0){
score = 0;
};
}
private function removeTile(_arg1:Tile):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = _arg1.index;
_local3 = (_local2 % Config.DIMENSION_X);
_local4 = 0;
while (_local4 < tilesRemovable.length) {
if (tilesRemovable[_local4] == _arg1){
tilesRemovable.splice(_local4, 1);
break;
};
_local4++;
};
_arg1.visible = false;
if ((((((_local3 > 0)) && (tiles[(_local2 - 1)]))) && (tileIsRemovable(tiles[(_local2 - 1)])))){
addTilesRemovable(tiles[(_local2 - 1)]);
};
if ((((((_local3 < (Config.DIMENSION_X - 1))) && (tiles[(_local2 + 1)]))) && (tileIsRemovable(tiles[(_local2 + 1)])))){
addTilesRemovable(tiles[(_local2 + 1)]);
};
if ((((((_local2 >= (Config.DIMENSION_X * Config.DIMENSION_Y))) && (tiles[(_local2 - (Config.DIMENSION_X * Config.DIMENSION_Y))]))) && (tileIsRemovable(tiles[(_local2 - (Config.DIMENSION_X * Config.DIMENSION_Y))])))){
addTilesRemovable(tiles[(_local2 - (Config.DIMENSION_X * Config.DIMENSION_Y))]);
};
if (_local2 == 45){
if (tileIsRemovable(tiles[61])){
addTilesRemovable(tiles[61]);
};
} else {
if (_local2 == 73){
if (tileIsRemovable(tiles[57])){
addTilesRemovable(tiles[57]);
};
} else {
if (_local2 == 57){
if (tileIsRemovable(tiles[73])){
addTilesRemovable(tiles[73]);
};
} else {
if (_local2 == 547){
addTilesRemovable(tiles[411]);
addTilesRemovable(tiles[412]);
addTilesRemovable(tiles[426]);
};
};
};
};
}
private function setTileType(_arg1:Tile, _arg2:Number, _arg3:Number):void{
_arg1.type = _arg2;
_arg1.tileGraphics.gotoAndStop(Config.TILE_INFOS[_arg2][_arg3]);
}
private function newGame():void{
var _local1:Number;
_local1 = 0;
while (_local1 < tilesReal.length) {
tilesReal[_local1].visible = true;
tilesReal[_local1].type = -1;
_local1++;
};
putTiles();
restart(null);
}
private function checkWin():Boolean{
var _local1:Number;
_local1 = 0;
while (_local1 < tilesReal.length) {
if (tilesReal[_local1].visible){
return (false);
};
_local1++;
};
gameWin();
return (true);
}
private function putTiles():void{
var _local1:Number;
var _local2:Array;
var _local3:Array;
while (true) {
updateTilesRemovable();
_local2 = getTileTypesPairs();
_local1 = 0;
while (_local1 < _local2.length) {
_local3 = getPutPair();
if (_local3 == null){
break;
};
setTileType(_local3[0], _local2[_local1].type, _local2[_local1].index0);
setTileType(_local3[1], _local2[_local1].type, _local2[_local1].index1);
removeTile(_local3[0]);
removeTile(_local3[1]);
_local1++;
};
if (_local1 >= _local2.length){
break;
};
_local1 = 0;
while (_local1 < tilesReal.length) {
tilesReal[_local1].visible = true;
_local1++;
};
};
}
public function set minutes(_arg1:Number):void{
__minutes = _arg1;
minutesText.text = _arg1.toString();
}
private function addTilesRemovable(_arg1:Tile):void{
var _local2:Number;
_local2 = 0;
while (_local2 < tilesRemovable.length) {
if (tilesRemovable[_local2] == _arg1){
return;
};
_local2++;
};
tilesRemovable.push(_arg1);
}
private function gameOver():void{
var _local1:Timer;
gameStarted = false;
score = 0;
endDialog.showGameOver();
soundGameOver.play();
restartButton.visible = false;
hintButton.visible = false;
_local1 = new NewTimer(Config.MESSAGE_GAMEOVERTIME, 1);
_local1.addEventListener(TimerEvent.TIMER, showPlayAgain);
_local1.start();
}
private function updateTilesRemovable():void{
var _local1:Number;
tilesRemovable = new Array();
_local1 = 0;
while (_local1 < tilesReal.length) {
if (tileIsRemovable(tilesReal[_local1])){
tilesRemovable.push(tilesReal[_local1]);
};
_local1++;
};
}
}
}//package com.novelgames.flashgames.mahjongg
Section 11
//Main (com.novelgames.flashgames.mahjongg.Main)
package com.novelgames.flashgames.mahjongg {
import com.novelgames.flashgames.common.*;
import flash.media.*;
public class Main extends MainDevelopment {
public var title:Title;
override protected function getMusicGame():Sound{
return (new MusicGame());
}
override protected function getGame():Game{
return (new Game());
}
override protected function getTitle():Title{
return (title);
}
}
}//package com.novelgames.flashgames.mahjongg
Section 12
//MessagePlayAgain (com.novelgames.flashgames.mahjongg.MessagePlayAgain)
package com.novelgames.flashgames.mahjongg {
import flash.display.*;
public dynamic class MessagePlayAgain extends MovieClip {
public var playAgainSameTilesButton:SimpleButton;
public var playAgainButton:SimpleButton;
public var homeButton:SimpleButton;
}
}//package com.novelgames.flashgames.mahjongg
Section 13
//MusicGame (com.novelgames.flashgames.mahjongg.MusicGame)
package com.novelgames.flashgames.mahjongg {
import flash.media.*;
public dynamic class MusicGame extends Sound {
}
}//package com.novelgames.flashgames.mahjongg
Section 14
//SelectDialog (com.novelgames.flashgames.mahjongg.SelectDialog)
package com.novelgames.flashgames.mahjongg {
import flash.events.*;
import flash.display.*;
public class SelectDialog extends MovieClip {
public var blocker:SimpleButton;
public var selectButton0:SimpleButton;
public var selectButton1:SimpleButton;
public function SelectDialog(){
selectButton0.addEventListener(MouseEvent.CLICK, selectButtonClicked);
selectButton1.addEventListener(MouseEvent.CLICK, selectButtonClicked);
blocker.useHandCursor = false;
}
private function selectButtonClicked(_arg1:MouseEvent):void{
var _local2:int;
_local2 = ((_arg1.currentTarget == selectButton0)) ? 0 : 1;
Object(parent).startPlay(_local2);
}
}
}//package com.novelgames.flashgames.mahjongg
Section 15
//SoundGameOver (com.novelgames.flashgames.mahjongg.SoundGameOver)
package com.novelgames.flashgames.mahjongg {
import flash.media.*;
public dynamic class SoundGameOver extends Sound {
}
}//package com.novelgames.flashgames.mahjongg
Section 16
//SoundMatch (com.novelgames.flashgames.mahjongg.SoundMatch)
package com.novelgames.flashgames.mahjongg {
import flash.media.*;
public dynamic class SoundMatch extends Sound {
}
}//package com.novelgames.flashgames.mahjongg
Section 17
//SoundTile (com.novelgames.flashgames.mahjongg.SoundTile)
package com.novelgames.flashgames.mahjongg {
import flash.media.*;
public dynamic class SoundTile extends Sound {
}
}//package com.novelgames.flashgames.mahjongg
Section 18
//SoundWin (com.novelgames.flashgames.mahjongg.SoundWin)
package com.novelgames.flashgames.mahjongg {
import flash.media.*;
public dynamic class SoundWin extends Sound {
}
}//package com.novelgames.flashgames.mahjongg
Section 19
//SoundWrong (com.novelgames.flashgames.mahjongg.SoundWrong)
package com.novelgames.flashgames.mahjongg {
import flash.media.*;
public dynamic class SoundWrong extends Sound {
}
}//package com.novelgames.flashgames.mahjongg
Section 20
//Tile (com.novelgames.flashgames.mahjongg.Tile)
package com.novelgames.flashgames.mahjongg {
import flash.events.*;
import flash.display.*;
public class Tile extends MovieClip {
public var button:SimpleButton;
public var tileGraphics:MovieClip;
public var tileGraphicsHolder:MovieClip;
public var type:Number;
public var index:Number;
public function Tile(){
addFrameScript(20, frame21);
this["cacheAsBitmap"] = true;
stop();
button.addEventListener(MouseEvent.CLICK, buttonClicked);
}
public function setTileSet(_arg1:Number):void{
tileGraphics = ((_arg1 == 0)) ? new TileGraphics0() : new TileGraphics1();
tileGraphicsHolder.addChild(tileGraphics);
}
public function showHint():void{
gotoAndPlay("hint");
}
private function hintAnimationFinished():void{
gotoAndStop("normal");
}
function frame21(){
hintAnimationFinished();
}
private function buttonClicked(_arg1:MouseEvent):void{
Object(parent.parent).clickTile(this);
}
public function showSelected():void{
gotoAndStop("selected");
}
}
}//package com.novelgames.flashgames.mahjongg
Section 21
//TileGraphics0 (com.novelgames.flashgames.mahjongg.TileGraphics0)
package com.novelgames.flashgames.mahjongg {
import flash.display.*;
public dynamic class TileGraphics0 extends MovieClip {
}
}//package com.novelgames.flashgames.mahjongg
Section 22
//TileGraphics1 (com.novelgames.flashgames.mahjongg.TileGraphics1)
package com.novelgames.flashgames.mahjongg {
import flash.display.*;
public dynamic class TileGraphics1 extends MovieClip {
}
}//package com.novelgames.flashgames.mahjongg