Section 1
//logoani_9 (color_match_fla.logoani_9)
package color_match_fla {
import flash.display.*;
public dynamic class logoani_9 extends MovieClip {
public function logoani_9(){
addFrameScript(95, frame96);
}
function frame96(){
stop();
}
}
}//package color_match_fla
Section 2
//color_match (color_match)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import flash.net.*;
public class color_match extends MovieClip {
public var secCounter:TextField;
public var myplay:MovieClip;
public var loader_txt:TextField;
public var bar_mc:MovieClip;
public var y8logo:SimpleButton;
public var minCounter:TextField;
public var mymoregame:MovieClip;
public var flashcartoongames:SimpleButton;
public var finalScreen:congratPopup;
public var myButton:MovieClip;
public var moregames:SimpleButton;
public var num_clicks:TextField;
public var fm_menu:ContextMenu;
public var copyright:ContextMenuItem;
public var credit:ContextMenuItem;
private var first_tile:colors;
private var second_tile:colors;
private var pause_timer:Timer;
var colordeck:Array;
private var numberClicks:int;// = 0
private var gameTimer:Timer;
private var numSeconds:int;// = 0
private var numVisibleChildren:int;// = 16
public function color_match(){
colordeck = new Array(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8);
super();
addFrameScript(0, frame1, 119, frame120, 120, frame121, 121, frame122);
}
public function visit_flashcartoongames(_arg1:Event){
var _local2:URLRequest = new URLRequest("http://www.flashcartoongames.com/");
navigateToURL(_local2, "_parent");
}
public function loading(_arg1:Event):void{
var _local2:Number = this.stage.loaderInfo.bytesTotal;
var _local3:Number = this.stage.loaderInfo.bytesLoaded;
bar_mc.scaleX = (_local3 / _local2);
loader_txt.text = (Math.floor(((_local3 / _local2) * 100)) + "%");
if (_local2 == _local3){
play();
this.removeEventListener(Event.ENTER_FRAME, loading);
};
}
public function onReleaseMyButton(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest();
_local2.url = "http://www.flashcartoongames.com/";
navigateToURL(_local2, "_blank");
}
public function onReleasemymoregame(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest();
_local2.url = "http://www.flashcartoongames.com/";
navigateToURL(_local2, "_blank");
}
public function btn1Listener(_arg1:MouseEvent):void{
gotoAndStop(1, "Scene 2");
}
public function onReleaseflashcartoongames(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest();
_local2.url = "http://www.flashcartoongames.com/";
navigateToURL(_local2, "_blank");
}
public function onReleasey8logo(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest();
_local2.url = "http://www.y8.com/";
navigateToURL(_local2, "_blank");
}
public function onReleasemoregames(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest();
_local2.url = "http://www.flashcartoongames.com/online37-Bratz-Games";
navigateToURL(_local2, "_blank");
}
public function startGame(){
var _local1:*;
var _local2:colors;
x = 1;
while (x <= 4) {
y = 1;
while (y <= 4) {
_local1 = Math.floor((Math.random() * colordeck.length));
_local2 = new colors();
_local2.col = colordeck[_local1];
colordeck.splice(_local1, 1);
_local2.gotoAndStop(9);
_local2.x = ((x - 0.7) * 115);
_local2.y = ((y - 0.7) * 115);
_local2.addEventListener(MouseEvent.CLICK, tile_clicked);
addChild(_local2);
y++;
};
x++;
};
gameTimer = new Timer(1000);
gameTimer.addEventListener(TimerEvent.TIMER, gameTimerChange_eventHandler);
gameTimer.start();
num_clicks.text = numberClicks.toString();
}
public function tile_clicked(_arg1:MouseEvent){
if (((!((second_tile == null))) && (!((first_tile == null))))){
return;
};
numberClicks++;
num_clicks.text = String(numberClicks);
var _local2:colors = (_arg1.currentTarget as colors);
if (first_tile == null){
first_tile = _local2;
first_tile.gotoAndStop(_local2.col);
} else {
if ((((second_tile == null)) && (!((first_tile == _local2))))){
second_tile = _local2;
second_tile.gotoAndStop(_local2.col);
if (first_tile.col == second_tile.col){
pause_timer = new Timer(1000, 1);
pause_timer.addEventListener(TimerEvent.TIMER_COMPLETE, remove_tiles);
pause_timer.start();
} else {
pause_timer = new Timer(1000, 1);
pause_timer.addEventListener(TimerEvent.TIMER_COMPLETE, reset_tiles);
pause_timer.start();
};
};
};
}
public function reset_tiles(_arg1:TimerEvent){
first_tile.gotoAndStop(9);
second_tile.gotoAndStop(9);
first_tile = null;
second_tile = null;
pause_timer.removeEventListener(TimerEvent.TIMER_COMPLETE, reset_tiles);
}
public function remove_tiles(_arg1:TimerEvent){
removeChild(first_tile);
removeChild(second_tile);
first_tile = null;
second_tile = null;
pause_timer.removeEventListener(TimerEvent.TIMER_COMPLETE, remove_tiles);
numVisibleChildren = (numVisibleChildren - 2);
if (numVisibleChildren == 0){
gameTimer.stop();
gotoAndStop(2);
};
}
private function gameTimerChange_eventHandler(_arg1:TimerEvent):void{
numSeconds++;
minCounter.text = String(Math.floor((numSeconds / 60)));
secCounter.text = String((numSeconds % 60));
}
function frame1(){
fm_menu = new ContextMenu();
copyright = new ContextMenuItem("Created by www.flashcartoongames.com");
credit = new ContextMenuItem("flashcartoongames");
copyright.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_flashcartoongames);
credit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_flashcartoongames);
credit.separatorBefore = false;
fm_menu.hideBuiltInItems();
fm_menu.customItems.push(copyright, credit);
this.contextMenu = fm_menu;
stop();
this.addEventListener(Event.ENTER_FRAME, loading);
myButton.addEventListener(MouseEvent.CLICK, onReleaseMyButton);
}
function frame120(){
stop();
mymoregame.addEventListener(MouseEvent.CLICK, onReleasemymoregame);
myplay.addEventListener(MouseEvent.CLICK, btn1Listener);
}
function frame121(){
flashcartoongames.addEventListener(MouseEvent.CLICK, onReleaseflashcartoongames);
y8logo.addEventListener(MouseEvent.CLICK, onReleasey8logo);
stop();
startGame();
moregames.addEventListener(MouseEvent.CLICK, onReleasemoregames);
}
function frame122(){
finalScreen.completeTime.text = (((minCounter.text + " min ") + secCounter.text) + " sec");
finalScreen.numClicks.text = (String(numberClicks) + " clicks");
}
}
}//package
Section 3
//colors (colors)
package {
import flash.display.*;
public dynamic class colors extends MovieClip {
}
}//package
Section 4
//congratPopup (congratPopup)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public dynamic class congratPopup extends MovieClip {
public var numClicks:TextField;
public var completeTime:TextField;
public var moregames:SimpleButton;
public function congratPopup(){
addFrameScript(0, frame1);
}
public function onReleasemoregames(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest();
_local2.url = "http://www.flashcartoongames.com/online37-Bratz-Games";
navigateToURL(_local2, "_blank");
}
function frame1(){
moregames.addEventListener(MouseEvent.CLICK, onReleasemoregames);
}
}
}//package