Section 1
//DlgComment_46 (linyca_fla.DlgComment_46)
package linyca_fla {
import flash.display.*;
import flash.text.*;
public dynamic class DlgComment_46 extends MovieClip {
public var bn_close:SimpleButton;
public var bn_submit:SimpleButton;
public var fld_comment:TextField;
public var fld_name:TextField;
public var bn_view:SimpleButton;
}
}//package linyca_fla
Section 2
//DlgHelp_41 (linyca_fla.DlgHelp_41)
package linyca_fla {
import flash.display.*;
import flash.text.*;
public dynamic class DlgHelp_41 extends MovieClip {
public var bn_close_help:SimpleButton;
public var txt_site:TextField;
}
}//package linyca_fla
Section 3
//DlgNotConnectScores_45 (linyca_fla.DlgNotConnectScores_45)
package linyca_fla {
import flash.display.*;
public dynamic class DlgNotConnectScores_45 extends MovieClip {
public var bn_close:SimpleButton;
}
}//package linyca_fla
Section 4
//DlgPlay_44 (linyca_fla.DlgPlay_44)
package linyca_fla {
import flash.display.*;
public dynamic class DlgPlay_44 extends MovieClip {
public var bn_new:SimpleButton;
public var bn_continue:SimpleButton;
}
}//package linyca_fla
Section 5
//Rating_32 (linyca_fla.Rating_32)
package linyca_fla {
import flash.display.*;
public dynamic class Rating_32 extends MovieClip {
public var mc_mask:MovieClip;
}
}//package linyca_fla
Section 6
//sounds_30 (linyca_fla.sounds_30)
package linyca_fla {
import flash.display.*;
public dynamic class sounds_30 extends MovieClip {
public function sounds_30(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package linyca_fla
Section 7
//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 8
//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.32");
}
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 (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
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 9
//BtnMute (BtnMute)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
public class BtnMute extends MovieClip {
public static var _isEnable:Boolean = true;
public function BtnMute(){
stop();
addEventListener(MouseEvent.CLICK, onClick);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDn);
useHandCursor = true;
buttonMode = true;
initFrame();
}
function initFrame(){
if (_isEnable){
gotoAndStop(1);
} else {
gotoAndStop(2);
};
}
function toggle(){
_isEnable = !(_isEnable);
initFrame();
Sfx.play(SfxClick);
}
private function onKeyDn(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.F12)) || ((_arg1.keyCode == Keyboard.NUMPAD_MULTIPLY)))){
toggle();
};
}
private function onClick(_arg1:MouseEvent):void{
toggle();
}
}
}//package
Section 10
//BtnQuality (BtnQuality)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
public class BtnQuality extends MovieClip {
public function BtnQuality(){
addEventListener(MouseEvent.CLICK, onClick);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDn);
useHandCursor = true;
buttonMode = true;
initFrame();
}
function switchToNextMode(){
var _local1:String;
Sfx.play(SfxClick);
_local1 = stage.quality.toLowerCase();
if (_local1 == StageQuality.LOW){
stage.quality = StageQuality.BEST;
gotoAndStop(4);
} else {
if (_local1 == StageQuality.BEST){
stage.quality = StageQuality.HIGH;
gotoAndStop(3);
} else {
if (_local1 == StageQuality.HIGH){
stage.quality = StageQuality.MEDIUM;
gotoAndStop(2);
} else {
if (_local1 == StageQuality.MEDIUM){
stage.quality = StageQuality.LOW;
gotoAndStop(1);
};
};
};
};
}
private function initFrame():void{
var _local1:String;
_local1 = stage.quality.toLowerCase();
if (_local1 == StageQuality.LOW){
gotoAndStop(1);
} else {
if (_local1 == StageQuality.BEST){
gotoAndStop(4);
} else {
if (_local1 == StageQuality.HIGH){
gotoAndStop(3);
} else {
if (_local1 == StageQuality.MEDIUM){
gotoAndStop(2);
};
};
};
};
}
private function onKeyDn(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.F11)) || ((_arg1.keyCode == Keyboard.NUMPAD_DIVIDE)))){
switchToNextMode();
};
}
private function onClick(_arg1:MouseEvent):void{
switchToNextMode();
}
}
}//package
Section 11
//BtnVolume (BtnVolume)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.ui.*;
public class BtnVolume extends MovieClip {
var _isMDn:Boolean;// = false
static var _sndTransform:SoundTransform = new SoundTransform();
public function BtnVolume(){
_isMDn = false;
super();
stop();
addEventListener(Event.ADDED_TO_STAGE, onAdded);
addEventListener(Event.REMOVED_FROM_STAGE, onRemoved);
setVolume(_sndTransform.volume);
useHandCursor = true;
}
private function onMDown(_arg1:MouseEvent):void{
_isMDn = true;
setVolumeByMouseX(_arg1.stageX);
}
public function setVolume(_arg1:Number){
if (_arg1 < 0){
_arg1 = 0;
} else {
if (_arg1 > 1){
_arg1 = 1;
};
};
trace(("vol is " + _arg1));
_sndTransform.volume = _arg1;
SoundMixer.soundTransform = _sndTransform;
gotoAndStop(int((_arg1 * 100)));
trace(("volume pos is " + (_arg1 * 100)));
trace(("frame is " + this.currentFrame));
}
private function onMMove(_arg1:MouseEvent):void{
if (_isMDn){
setVolumeByMouseX(_arg1.stageX);
};
}
private function onAdded(_arg1:Event):void{
stage.addEventListener(MouseEvent.MOUSE_UP, onMUp);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMMove);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDn);
addEventListener(MouseEvent.MOUSE_DOWN, onMDown);
addEventListener(MouseEvent.MOUSE_WHEEL, onMWheel);
}
private function onRemoved(_arg1:Event):void{
stage.removeEventListener(MouseEvent.MOUSE_UP, onMUp);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMMove);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDn);
removeEventListener(MouseEvent.MOUSE_DOWN, onMDown);
removeEventListener(MouseEvent.MOUSE_WHEEL, onMWheel);
}
private function onMUp(_arg1:MouseEvent):void{
_isMDn = false;
}
private function onMWheel(_arg1:MouseEvent):void{
setVolume((_sndTransform.volume + (_arg1.delta * 0.01)));
}
private function onKeyDn(_arg1:KeyboardEvent):void{
var _local2:Number;
_local2 = 0.02;
switch (_arg1.keyCode){
case Keyboard.NUMPAD_ADD:
setVolume((_sndTransform.volume + _local2));
break;
case Keyboard.NUMPAD_SUBTRACT:
setVolume((_sndTransform.volume - _local2));
break;
};
}
private function setVolumeByMouseX(_arg1:Number){
var _local2:Number;
trace(((("pos x is " + x) + "; mouse x is ") + _arg1));
_local2 = ((_arg1 - x) / width);
setVolume(_local2);
}
}
}//package
Section 12
//ColorComboInfo (ColorComboInfo)
package {
import flash.display.*;
public dynamic class ColorComboInfo extends MovieClip {
}
}//package
Section 13
//CProgressbar (CProgressbar)
package {
import flash.display.*;
public class CProgressbar {
public var h:Number;// = 10
public var w:Number;// = 100
public var x:Number;// = 1
public var y:Number;// = 1
public var frontColor:int;// = 0
public var backColor:int;// = 0xFFFFFF
public function CProgressbar(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=10, _arg5:int=0xFFFFFF, _arg6:int=0){
backColor = 0xFFFFFF;
frontColor = 0;
x = 1;
y = 1;
w = 100;
h = 10;
super();
x = _arg1;
y = _arg2;
w = _arg3;
h = _arg4;
backColor = _arg5;
frontColor = _arg6;
}
public function draw(_arg1:Number, _arg2:Graphics):void{
var percent = _arg1;
var gx = _arg2;
var _local4 = gx;
with (_local4) {
clear();
lineStyle(1, frontColor);
drawRect(x, y, w, h);
beginFill(frontColor);
drawRect((x + 1), (y + 1), (((w - 2) * percent) * 0.01), (h - 2));
};
}
}
}//package
Section 14
//DlgGameOver (DlgGameOver)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class DlgGameOver extends MovieClip {
public var txt_score:TextField;
public var bn_more_games:SimpleButton;
public var bn_scores:SimpleButton;
public var bn_menu:SimpleButton;
public function DlgGameOver(){
addFrameScript(0, frame1);
}
function gotoMenu(_arg1:MouseEvent){
(parent as Game).gotoToMenu(_arg1);
remove();
}
function gotoScores(_arg1:MouseEvent){
(parent as Game).submitScores();
remove();
}
function frame1(){
initDialog();
}
function initDialog(){
this["bn_menu"].addEventListener(MouseEvent.CLICK, gotoMenu);
this["bn_scores"].addEventListener(MouseEvent.CLICK, gotoScores);
this["bn_more_games"].addEventListener(MouseEvent.CLICK, Main.gotoMoreGames);
}
function remove(){
parent.removeChild(this);
}
}
}//package
Section 15
//DlgLevelComplete (DlgLevelComplete)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public dynamic class DlgLevelComplete extends MovieClip {
public var txt_score:TextField;
public var bn_stop:SimpleButton;
public var txt_fullclear:TextField;
public var txt_flinecombos:TextField;
public var bn_play:SimpleButton;
public var txt_colorcombos:TextField;
public var bn_continue:SimpleButton;
public var txt_hlinecombos:TextField;
public var txt_site:TextField;
public function DlgLevelComplete(){
addFrameScript(0, frame1);
}
function gotoGame(_arg1:MouseEvent){
var _local2:Game;
_local2 = (parent as Game);
remove();
_local2.nextLevel();
}
function playLevelSound(_arg1:MouseEvent){
var _local2:Game;
_local2 = (parent as Game);
_local2.playLevelSound(_arg1);
this["bn_play"].visible = false;
this["bn_stop"].visible = true;
}
function gotoMenu(_arg1:MouseEvent){
var _local2:Game;
_local2 = (parent as Game);
remove();
_local2.returnToMenu(_arg1);
}
function frame1(){
initDialog();
fillData();
stop();
}
function initDialog(){
this["bn_play"].addEventListener(MouseEvent.CLICK, playLevelSound);
this["bn_stop"].addEventListener(MouseEvent.CLICK, stopLevelSound);
this["bn_stop"].visible = false;
this["bn_continue"].addEventListener(MouseEvent.CLICK, gotoGame);
this["txt_site"].addEventListener(MouseEvent.CLICK, Main.gotoGamePage);
}
function remove(){
parent.removeChild(this);
}
function stopLevelSound(_arg1:MouseEvent){
var _local2:Game;
_local2 = (parent as Game);
_local2.stopLevelSound(_arg1);
this["bn_play"].visible = true;
this["bn_stop"].visible = false;
}
function fillData(){
var game:Game;
game = Game(parent);
if (game){
var _local2 = game._level_stats;
with (_local2) {
TextField(this["txt_score"]).text = _score.toString();
if (_full_clear){
TextField(this["txt_fullclear"]).text = "YES";
} else {
TextField(this["txt_fullclear"]).text = "NO";
};
TextField(this["txt_colorcombos"]).text = _color_combos.toString();
TextField(this["txt_flinecombos"]).text = _full_line_combos.toString();
TextField(this["txt_hlinecombos"]).text = _half_line_combos.toString();
};
};
}
}
}//package
Section 16
//DlgOptions (DlgOptions)
package {
import flash.display.*;
public dynamic class DlgOptions extends MovieClip {
public var bn_close_options:SimpleButton;
}
}//package
Section 17
//Element1 (Element1)
package {
import flash.display.*;
public dynamic class Element1 extends MovieClip {
}
}//package
Section 18
//Element2 (Element2)
package {
import flash.display.*;
public dynamic class Element2 extends MovieClip {
}
}//package
Section 19
//Element3 (Element3)
package {
import flash.display.*;
public dynamic class Element3 extends MovieClip {
}
}//package
Section 20
//Element4 (Element4)
package {
import flash.display.*;
public dynamic class Element4 extends MovieClip {
}
}//package
Section 21
//Element5 (Element5)
package {
import flash.display.*;
public dynamic class Element5 extends MovieClip {
}
}//package
Section 22
//Element6 (Element6)
package {
import flash.display.*;
public dynamic class Element6 extends MovieClip {
}
}//package
Section 23
//Element7 (Element7)
package {
import flash.display.*;
public dynamic class Element7 extends MovieClip {
}
}//package
Section 24
//Element8 (Element8)
package {
import flash.display.*;
public dynamic class Element8 extends MovieClip {
}
}//package
Section 25
//Element9 (Element9)
package {
import flash.display.*;
public dynamic class Element9 extends MovieClip {
}
}//package
Section 26
//Game (Game)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
public dynamic class Game extends MovieClip {
public var txt_score:TextField;
var _animationDelayCnt:int;
var _play_timer:Timer;
var _dlgGameOver:DlgGameOver;
var _colorComboLen:int;// = 5
var _score_pt:int;// = 10
var _level_types:int;// = 5
var _level_types_min:int;// = 5
var _cellw:int;// = 26
var _cellh:int;// = 26
var _elements:Array;
var _halfLineComboScore:int;// = 100
var _drop_list:Array;
var _fullClearScoreMul:int;// = 50
var _level_stats:LevelStats;
var _lastClickPt:Point;
public var ind_HalfLineCombo:MovieClip;
var _level:int;// = 1
var _drop_speed:Number;// = 2
var _dlgLevelComplete:DlgLevelComplete;
var _level_snd:Array;
var _animationDelay:int;// = 4
var _tb_Score:TextField;
public var tooltip_FullLineCombo:MovieClip;
var _level_col_height:int;// = 6
var _cColorCombo:Array;
var _colorComboScore:int;// = 100
var _soSave:SharedObject;
var _animatePt:Point;
var _index_mul_y:Number;
var _index_mul_x:Number;
var _level_types_max:int;// = 9
public var ind_cc1:Element1;
public var ind_cc2:Element2;
public var ind_cc3:Element3;
public var ind_cc5:Element5;
public var ind_cc6:Element6;
public var ind_cc7:Element7;
public var ind_cc8:Element8;
public var ind_cc9:Element9;
public var ind_cc4:Element4;
public var bn_menu:SimpleButton;
var _fieldBack:Sprite;
var _fieldBackMask:Sprite;
var _match_min:int;// = 2
var _score:int;
var _boardLayer:Sprite;
public var tooltip_HalfLineCombo:MovieClip;
var _play_ind:int;
public var ind_FullLineCombo:MovieClip;
var _ih:int;// = 12
var _fadeoff_list:Array;
var _iw:int;// = 12
public var tooltip_ColorCombo:ColorComboInfo;
var _bounds:Rectangle;
var _megaComboScore:int;// = 5000
var _board:Array;
var _fullLineComboScore:int;// = 500
public function Game(){
var txt:FlayoutText;
_iw = 12;
_ih = 12;
_cellw = 26;
_cellh = 26;
_index_mul_x = (1 / _cellw);
_index_mul_y = (1 / _cellh);
_match_min = 2;
_drop_speed = 2;
_level_col_height = 6;
_level_types = 5;
_level_types_min = 5;
_level_types_max = 9;
_fadeoff_list = new Array();
_drop_list = new Array();
_bounds = new Rectangle(-221, -143, (_cellw * _iw), (_cellh * _ih));
_elements = [Element1, Element2, Element3, Element4, Element5, Element6, Element7, Element8, Element9];
_score_pt = 10;
_level_stats = new LevelStats();
_lastClickPt = new Point();
_animatePt = new Point();
_cColorCombo = new Array();
_colorComboLen = 5;
_colorComboScore = 100;
_fullLineComboScore = 500;
_halfLineComboScore = 100;
_megaComboScore = 5000;
_animationDelay = 4;
_fullClearScoreMul = 50;
_level_snd = new Array();
_play_timer = new Timer(400);
_level = 1;
_dlgLevelComplete = new DlgLevelComplete();
_dlgGameOver = new DlgGameOver();
_soSave = SharedObject.getLocal("game_progress");
super();
addFrameScript(0, frame1);
x = Main.HWIDTH;
y = Main.HHEIGHT;
stop();
_board = newArray2D(_iw, _ih);
_fieldBack = new Sprite();
var _local2 = _fieldBack.graphics;
with (_local2) {
beginFill(3386111);
drawRoundRect((-8 - (_cellw / 2)), (-8 - (_cellh / 2)), ((_iw * _cellw) + 16), ((_ih * _cellh) + 16), 16, 16);
};
_fieldBack.x = _bounds.x;
_fieldBack.y = _bounds.y;
addChild(_fieldBack);
_fieldBackMask = new Sprite();
_local2 = _fieldBackMask.graphics;
with (_local2) {
beginFill(0xFFFFFF);
drawRect((-8 - (_cellw / 2)), (-(_cellh) / 2), ((_cellw * _iw) + 16), ((_cellh * _ih) + 16));
};
_fieldBackMask.x = _bounds.x;
positionFieldMask();
addChild(_fieldBackMask);
_fieldBack.mask = _fieldBackMask;
_boardLayer = new Sprite();
addChild(_boardLayer);
fillBoard();
addEventListener(Event.ENTER_FRAME, animateRemove, false, 0, true);
txt = new FlayoutText(-78, 0, ("Level " + _level), 0xFFFF00, "Valken", 20, false);
addChild(txt);
_level_stats.reset();
}
function playLevelSound(_arg1:MouseEvent){
if (_play_timer.running){
stopLevelSound(_arg1);
} else {
_play_ind = 0;
_play_timer.addEventListener(TimerEvent.TIMER, animateLevelSound);
_play_timer.start();
};
}
function showLevelCompleteDialog(){
addChild(_dlgLevelComplete);
_dlgLevelComplete.fillData();
var _local2 = (this["bn_menu"] as SimpleButton);
with (_local2) {
removeEventListener(MouseEvent.CLICK, returnToMenu);
enabled = false;
};
enabled = false;
if (this.parent){
Sfx.play(SfxComplete);
};
save();
_soSave.data.level_complete = true;
}
function nextLevel(){
var txt:FlayoutText;
Sfx.play(SfxClick);
if (!SimpleButton(this["bn_menu"]).enabled){
var _local2 = (this["bn_menu"] as SimpleButton);
with (_local2) {
enabled = true;
addEventListener(MouseEvent.CLICK, returnToMenu);
};
};
enabled = true;
_level_snd.splice(0, _level_snd.length);
_level_types++;
if (_level_types > _level_types_max){
_level_types = _level_types_min;
_level_col_height--;
addEventListener(Event.ENTER_FRAME, moveMask);
if (_level_col_height < 0){
_level_col_height = (_ih / 2);
_match_min++;
};
};
clearBoard();
fillBoard();
_level_stats.reset();
_level++;
_score_pt = (_score_pt + 5);
txt = new FlayoutText(-78, 0, ("Level " + _level), 0xFFFF00, "Valken", 20, false);
addChild(txt);
save();
}
function submitScores(){
(parent as Main).game = null;
(parent as Main).submitScores(_score);
remove();
}
function frame1(){
initGame();
}
function free(){
removeEventListener(Event.ENTER_FRAME, animateRemove);
clearBoard();
this["bn_menu"].removeEventListener(MouseEvent.CLICK, returnToMenu);
this["ind_cc1"].removeEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc1"].removeEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc2"].removeEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc2"].removeEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc3"].removeEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc3"].removeEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc4"].removeEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc4"].removeEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc5"].removeEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc5"].removeEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc6"].removeEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc6"].removeEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc7"].removeEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc7"].removeEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc8"].removeEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc8"].removeEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc9"].removeEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc9"].removeEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_HalfLineCombo"].removeEventListener(MouseEvent.MOUSE_OVER, showTooltipHLineCombo);
this["ind_HalfLineCombo"].removeEventListener(MouseEvent.MOUSE_OUT, hideTooltipHLineCombo);
this["ind_FullLineCombo"].removeEventListener(MouseEvent.MOUSE_OVER, showTooltipFLineCombo);
this["ind_FullLineCombo"].removeEventListener(MouseEvent.MOUSE_OUT, hideTooltipFLineCombo);
}
function moveMask(_arg1:Event){
var _local2:Boolean;
_fieldBackMask.y = (_fieldBackMask.y + 0.5);
_local2 = false;
if (_level_col_height){
if (_fieldBackMask.y > (_bounds.y + ((_ih - _level_col_height) * _cellh))){
_local2 = true;
_fieldBackMask.y = (_bounds.y + ((_ih - _level_col_height) * _cellh));
};
} else {
if (_fieldBackMask.y > ((_bounds.y + (_cellh * _ih)) + 16)){
_local2 = true;
_fieldBackMask.y = ((_bounds.y + (_cellh * _ih)) + 16);
};
};
if (_local2){
removeEventListener(Event.ENTER_FRAME, moveMask);
};
}
function addScore(_arg1:int){
_score = (_score + _arg1);
_level_stats._score = (_level_stats._score + _arg1);
_tb_Score.text = _score.toString();
}
function remove(){
free();
parent.removeChild(this);
}
function clearBoard(){
var row:Array;
var ix:int;
for each (row in _board) {
ix = 0;
while (ix < row.length) {
if (row[ix]){
var _local4 = Sprite(row[ix]);
with (_local4) {
removeEventListener(MouseEvent.MOUSE_DOWN, onMousedn);
if (parent){
parent.removeChild(row[ix]);
};
};
row[ix] = null;
};
ix = (ix + 1);
};
};
}
function animateRemoveAll(_arg1:Event){
var _local2:DisplayObject;
_animationDelayCnt--;
if (_animationDelayCnt <= 0){
_animationDelayCnt = _animationDelay;
_animatePt.x = 0;
while (_animatePt.x < _iw) {
_local2 = DisplayObject(_board[_animatePt.y][_animatePt.x]);
if (_local2){
_board[_animatePt.y][_animatePt.x] = null;
_local2.removeEventListener(MouseEvent.MOUSE_DOWN, onMousedn);
if (_local2.parent){
_local2.parent.removeChild(_local2);
};
};
_animatePt.x++;
};
_animatePt.y++;
if (_animatePt.y >= _ih){
_animatePt.y = 0;
addEventListener(Event.ENTER_FRAME, animateRemove);
removeEventListener(Event.ENTER_FRAME, animateRemoveAll);
showLevelCompleteDialog();
};
};
}
function checkMegaBonus(){
var _local1:Number;
var _local2:FlayoutText;
var _local3:DisplayObject;
_local1 = 0;
_local1 = (_local1 + Sprite(this["ind_FullLineCombo"]).alpha);
_local1 = (_local1 + Sprite(this["ind_HalfLineCombo"]).alpha);
_local1 = (_local1 + Sprite(this["ind_cc1"]).alpha);
_local1 = (_local1 + Sprite(this["ind_cc2"]).alpha);
_local1 = (_local1 + Sprite(this["ind_cc3"]).alpha);
_local1 = (_local1 + Sprite(this["ind_cc4"]).alpha);
_local1 = (_local1 + Sprite(this["ind_cc5"]).alpha);
_local1 = (_local1 + Sprite(this["ind_cc6"]).alpha);
_local1 = (_local1 + Sprite(this["ind_cc7"]).alpha);
_local1 = (_local1 + Sprite(this["ind_cc8"]).alpha);
_local1 = (_local1 + Sprite(this["ind_cc9"]).alpha);
if (_local1 >= 11){
Sprite(this["ind_FullLineCombo"]).alpha = 0.25;
Sprite(this["ind_HalfLineCombo"]).alpha = 0.25;
Sprite(this["ind_cc1"]).alpha = 0.25;
Sprite(this["ind_cc2"]).alpha = 0.25;
Sprite(this["ind_cc3"]).alpha = 0.25;
Sprite(this["ind_cc4"]).alpha = 0.25;
Sprite(this["ind_cc5"]).alpha = 0.25;
Sprite(this["ind_cc6"]).alpha = 0.25;
Sprite(this["ind_cc7"]).alpha = 0.25;
Sprite(this["ind_cc8"]).alpha = 0.25;
Sprite(this["ind_cc9"]).alpha = 0.25;
Sfx.play(SfxMegaBonus);
_local2 = new FlayoutText(_lastClickPt.x, (_lastClickPt.y + 40), ("Excelent! +" + _megaComboScore), 8978431, "Tahoma", 12, true);
addChild(_local2);
addScore(_megaComboScore);
enabled = false;
_drop_list.splice(0, _drop_list.length);
removeEventListener(Event.ENTER_FRAME, animateDrop);
trace(("MEGABONUS fadeoff len " + _fadeoff_list.length));
while (_fadeoff_list.length) {
_local3 = DisplayObject(_fadeoff_list.pop());
if (_local3.parent){
_local3.parent.removeChild(_local3);
};
};
removeEventListener(Event.ENTER_FRAME, animateRemove);
_animatePt.x = 0;
_animatePt.y = 0;
_animationDelayCnt = _animationDelay;
addEventListener(Event.ENTER_FRAME, animateRemoveAll);
};
}
function animateRemove(_arg1:Event){
var _local2:int;
var _local3:MovieClip;
_local2 = 0;
while (_local2 < _fadeoff_list.length) {
_local3 = MovieClip(_fadeoff_list[_local2]);
_local3.alpha = (_local3.alpha - 0.05);
_local3.scaleX = (_local3.scaleX - 0.05);
_local3.scaleY = (_local3.scaleY - 0.05);
if (_local3.alpha < 0.2){
if (_local3.parent){
_local3.parent.removeChild(_local3);
} else {
trace(((((("Erorr remove element " + getQualifiedClassName(_local3)) + " at loc: ") + int(((_local3.x - _bounds.x) * _index_mul_x))) + ",") + int(((_local3.y - _bounds.y) * _index_mul_y))));
};
_fadeoff_list.splice(_local2, 1);
if ((((_fadeoff_list.length == 0)) && ((_drop_list.length == 0)))){
checkLevelEnd();
};
} else {
_local2++;
};
};
}
function showTooltipColorCombo(_arg1:MouseEvent){
var _local2:Sprite;
var _local3:Sprite;
_local2 = (_arg1.currentTarget as Sprite);
_local3 = (this["tooltip_ColorCombo"] as Sprite);
_local3.y = (_local2.y + Math.round((_local2.height * 0.5)));
_local3.visible = true;
}
function checkLineCombos(_arg1:Array){
var _local2:FlayoutText;
if (_arg1.length == _iw){
Sfx.play(SfxBonus);
_local2 = new FlayoutText(_lastClickPt.x, (_lastClickPt.y + 20), ("Perfect! +" + _fullLineComboScore), 0xFFFF00, "Tahoma", 12, true);
addChild(_local2);
addScore(_fullLineComboScore);
Sprite(this["ind_FullLineCombo"]).alpha = 1;
_level_stats._full_line_combos++;
checkMegaBonus();
} else {
if (_arg1.length >= (_iw / 2)){
Sfx.play(SfxBonus);
_local2 = new FlayoutText(_lastClickPt.x, (_lastClickPt.y + 20), ("Nice! +" + _halfLineComboScore), 0xFFFF00, "Tahoma", 12, true);
addChild(_local2);
addScore(_halfLineComboScore);
Sprite(this["ind_HalfLineCombo"]).alpha = 1;
_level_stats._half_line_combos++;
checkMegaBonus();
};
};
}
function addElementTo(_arg1:int, _arg2:int, _arg3:int){
var _local4:MovieClip;
if (_board[_arg2][_arg1]){
trace(((((("Error board not empty at " + _arg1) + ", ") + _arg2) + ": ") + getQualifiedClassName(_board[_arg2][_arg1])));
_local4 = (_board[_arg2][_arg1] as MovieClip);
_board[_arg2][_arg1] = null;
_local4.removeEventListener(MouseEvent.MOUSE_DOWN, onMousedn);
if (_local4.parent){
_local4.parent.removeChild(_local4);
};
};
_local4 = new (_elements[_arg3]);
_local4.cacheAsBitmap = true;
_local4.x = (_bounds.x + (_arg1 * _cellw));
_local4.y = (_bounds.y + (_arg2 * _cellh));
_local4.addEventListener(MouseEvent.MOUSE_DOWN, onMousedn, false, 0, true);
_local4.typeIndex = _arg3;
_board[_arg2][_arg1] = _local4;
_boardLayer.addChild(_local4);
}
function load(){
var _local1:Array;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Array;
var _local6:String;
if (_soSave.data.game){
_score = _soSave.data.score;
trace(("load score:" + _score));
_match_min = _soSave.data.match_min;
_level_col_height = _soSave.data.level_col_height;
_level_types = _soSave.data.level_types;
_score_pt = _soSave.data.score_pt;
_level = _soSave.data.level;
_level_stats._score = _soSave.data.level_score;
_level_stats._color_combos = _soSave.data.level_color_combos;
_level_stats._full_line_combos = _soSave.data.level_full_line_combos;
_level_stats._half_line_combos = _soSave.data.level_half_line_combos;
_level_stats._full_clear = _soSave.data.level_full_clear;
_cColorCombo = _soSave.data.cColorCombo;
trace(("load combo array:" + _cColorCombo));
clearBoard();
_local1 = _soSave.data.board;
_local4 = 0;
_local2 = 0;
while (_local2 < _iw) {
_local3 = 0;
while (_local3 < _ih) {
if (_local1[_local4] >= 0){
addElementTo(_local2, _local3, _local1[_local4]);
};
_local4++;
_local3++;
};
_local2++;
};
_local5 = _soSave.data.music;
_level_snd.length = 0;
for each (_local6 in _local5) {
_level_snd.push(getDefinitionByName(_local6));
};
trace(("load music:" + _level_snd));
positionFieldMask();
};
}
function onMousedn(_arg1:MouseEvent){
var _local2:Sprite;
var _local3:int;
var _local4:int;
var _local5:Array;
var _local6:Class;
var _local7:Object;
var _local8:String;
var _local9:int;
var _local10:int;
var _local11:FlayoutText;
var _local12:Class;
if (enabled){
_local2 = Sprite(_arg1.currentTarget);
_local3 = ((_local2.x - _bounds.x) * _index_mul_x);
_local4 = ((_local2.y - _bounds.y) * _index_mul_y);
trace(((((("click on " + getQualifiedClassName(_local2)) + " at ") + _local3) + ", ") + _local4));
_local5 = new Array();
_local8 = getQualifiedClassName(_local2);
_local9 = int(_local8.charAt((_local8.length - 1)));
trace(("index " + _local9));
_local6 = (getDefinitionByName(_local8) as Class);
for each (_local7 in _board[_local4]) {
if ((_local7 is _local6)){
_local5.push(_local7);
};
};
_lastClickPt.x = _local2.x;
_lastClickPt.y = (_local2.y - _cellh);
if (_local5.length >= _match_min){
removeElements(_local5);
_local10 = (_score_pt + (_score_pt * (_local5.length - _match_min)));
_local11 = new FlayoutText(_lastClickPt.x, _lastClickPt.y, _local10.toString(), 0xFFFF00, "Tahoma", 12, true);
addChild(_local11);
addScore(_local10);
_local12 = (getDefinitionByName(("SfxRemove" + _local9)) as Class);
Sfx.play(_local12);
_level_snd.push(_local12);
_cColorCombo.push(_local9);
} else {
if (_score){
addScore(-(_score_pt));
_local11 = new FlayoutText(_lastClickPt.x, _lastClickPt.y, ("-" + _score_pt.toString()), 0xFF0000, "Tahoma", 12, true);
addChild(_local11);
};
Sfx.play(SfxWrong);
};
};
}
function showTooltipFLineCombo(_arg1:MouseEvent){
var _local2:Sprite;
var _local3:Sprite;
_local2 = (this["tooltip_FullLineCombo"] as Sprite);
_local3 = Sprite(_arg1.currentTarget);
_local2.visible = true;
_local2.y = ((_local3.y + _local3.height) + 1);
}
function fillBoard(){
var _local1:Number;
var _local2:Number;
var _local3:int;
_local1 = 0;
while (_local1 < _board.length) {
_local2 = 0;
while (_local2 < _board[_local1].length) {
_local3 = MX.random(0, _level_types);
addElementTo(_local1, _local2, _local3);
_local2++;
};
_local1++;
};
}
function initGame(){
this["bn_menu"].addEventListener(MouseEvent.CLICK, returnToMenu);
_tb_Score = (this["txt_score"] as TextField);
_tb_Score.selectable = false;
_tb_Score.text = "0";
this["tooltip_ColorCombo"].visible = false;
this["ind_cc1"].addEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc1"].addEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc2"].addEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc2"].addEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc3"].addEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc3"].addEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc4"].addEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc4"].addEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc5"].addEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc5"].addEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc6"].addEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc6"].addEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc7"].addEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc7"].addEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc8"].addEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc8"].addEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["ind_cc9"].addEventListener(MouseEvent.MOUSE_OVER, showTooltipColorCombo);
this["ind_cc9"].addEventListener(MouseEvent.MOUSE_OUT, hideTooltipColorCombo);
this["tooltip_HalfLineCombo"].visible = false;
this["ind_HalfLineCombo"].addEventListener(MouseEvent.MOUSE_OVER, showTooltipHLineCombo);
this["ind_HalfLineCombo"].addEventListener(MouseEvent.MOUSE_OUT, hideTooltipHLineCombo);
this["tooltip_FullLineCombo"].visible = false;
this["ind_FullLineCombo"].addEventListener(MouseEvent.MOUSE_OVER, showTooltipFLineCombo);
this["ind_FullLineCombo"].addEventListener(MouseEvent.MOUSE_OUT, hideTooltipFLineCombo);
if (_soSave.data.game){
var _local2 = _soSave.data;
with (_local2) {
Sprite(this["ind_FullLineCombo"]).alpha = bFullLineCombo;
Sprite(this["ind_HalfLineCombo"]).alpha = bHalfLineCombo;
Sprite(this["ind_cc1"]).alpha = bind_cc1;
Sprite(this["ind_cc2"]).alpha = bind_cc2;
Sprite(this["ind_cc3"]).alpha = bind_cc3;
Sprite(this["ind_cc4"]).alpha = bind_cc4;
Sprite(this["ind_cc5"]).alpha = bind_cc5;
Sprite(this["ind_cc6"]).alpha = bind_cc6;
Sprite(this["ind_cc7"]).alpha = bind_cc7;
Sprite(this["ind_cc8"]).alpha = bind_cc8;
Sprite(this["ind_cc9"]).alpha = bind_cc9;
this["txt_score"].text = _score;
if (_soSave.data.level_complete){
showLevelCompleteDialog();
};
};
};
}
function showGameOverDialog(){
Sfx.play(SfxGameOver);
TextField(_dlgGameOver["txt_score"]).text = _score.toString();
addChild(_dlgGameOver);
var _local2 = (this["bn_menu"] as SimpleButton);
with (_local2) {
removeEventListener(MouseEvent.CLICK, returnToMenu);
enabled = false;
};
enabled = false;
_soSave.data.game = false;
}
function hideTooltipColorCombo(_arg1:MouseEvent){
this["tooltip_ColorCombo"].visible = false;
}
function showTooltipHLineCombo(_arg1:MouseEvent){
var _local2:Sprite;
var _local3:Sprite;
_local2 = (this["tooltip_HalfLineCombo"] as Sprite);
_local3 = Sprite(_arg1.currentTarget);
_local2.visible = true;
_local2.y = ((_local3.y + _local3.height) + 1);
}
function animateDrop(_arg1:Event):void{
var _local2:Boolean;
var _local3:DropElement;
_local2 = false;
for each (_local3 in _drop_list) {
_local3._element.y = (_local3._element.y + _drop_speed);
if (_local3._element.y >= _local3._dest_y){
_local3._element.y = _local3._dest_y;
_local2 = true;
};
};
if (_local2){
removeEventListener(Event.ENTER_FRAME, animateDrop);
trace("stop drop");
checkLevelEnd();
};
}
function save():void{
var _local1:Array;
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:Class;
_soSave.data.game = true;
_soSave.data.bFullLineCombo = Sprite(this["ind_FullLineCombo"]).alpha;
_soSave.data.bHalfLineCombo = Sprite(this["ind_HalfLineCombo"]).alpha;
_soSave.data.bind_cc1 = Sprite(this["ind_cc1"]).alpha;
_soSave.data.bind_cc2 = Sprite(this["ind_cc2"]).alpha;
_soSave.data.bind_cc3 = Sprite(this["ind_cc3"]).alpha;
_soSave.data.bind_cc4 = Sprite(this["ind_cc4"]).alpha;
_soSave.data.bind_cc5 = Sprite(this["ind_cc5"]).alpha;
_soSave.data.bind_cc6 = Sprite(this["ind_cc6"]).alpha;
_soSave.data.bind_cc7 = Sprite(this["ind_cc7"]).alpha;
_soSave.data.bind_cc8 = Sprite(this["ind_cc8"]).alpha;
_soSave.data.bind_cc9 = Sprite(this["ind_cc9"]).alpha;
_soSave.data.score = _score;
_soSave.data.match_min = _match_min;
_soSave.data.level_col_height = _level_col_height;
_soSave.data.level_types = _level_types;
_soSave.data.score_pt = _score_pt;
_soSave.data.level = _level;
_soSave.data.level_score = _level_stats._score;
_soSave.data.level_color_combos = _level_stats._color_combos;
_soSave.data.level_full_line_combos = _level_stats._full_line_combos;
_soSave.data.level_half_line_combos = _level_stats._half_line_combos;
_soSave.data.level_full_clear = _level_stats._full_clear;
_soSave.data.cColorCombo = _cColorCombo;
_local1 = new Array();
_local2 = 0;
while (_local2 < _iw) {
_local3 = 0;
while (_local3 < _ih) {
if (_board[_local3][_local2]){
_local1.push(_board[_local3][_local2].typeIndex);
} else {
_local1.push(-1);
};
_local3++;
};
_local2++;
};
_soSave.data.board = _local1;
_local4 = new Array();
for each (_local5 in _level_snd) {
_local4.push(getQualifiedClassName(_local5));
};
_soSave.data.music = _local4;
_soSave.data.level_complete = false;
trace("save data:");
trace(_soSave.data.game);
trace(_soSave.data.cColorCombo);
trace(_soSave.data.music);
}
function hideTooltipFLineCombo(_arg1:MouseEvent){
Sprite(this["tooltip_FullLineCombo"]).visible = false;
}
function stopLevelSound(_arg1:MouseEvent){
_play_timer.removeEventListener(TimerEvent.TIMER, animateLevelSound);
_play_timer.stop();
_dlgLevelComplete["bn_play"].visible = true;
_dlgLevelComplete["bn_stop"].visible = false;
}
function animateLevelSound(_arg1:TimerEvent){
if (_play_ind < _level_snd.length){
Sfx.play((_level_snd[_play_ind] as Class));
_play_ind++;
} else {
stopLevelSound(null);
};
}
function gotoToMenu(_arg1:MouseEvent){
Sfx.play(SfxClick);
(parent as Main).game = null;
remove();
}
function hideTooltipHLineCombo(_arg1:MouseEvent){
Sprite(this["tooltip_HalfLineCombo"]).visible = false;
}
function removeElements(_arg1:Array){
var _local2:MovieClip;
var _local3:int;
var _local4:int;
var _local5:int;
_drop_list.splice(0, _drop_list.length);
for each (_local2 in _arg1) {
_fadeoff_list.push(_local2);
_local2.removeEventListener(MouseEvent.MOUSE_DOWN, onMousedn);
_local3 = ((_local2.x - _bounds.x) * _index_mul_x);
_local4 = ((_local2.y - _bounds.y) * _index_mul_y);
_board[_local4][_local3] = null;
_local5 = (_local4 - 1);
while (_local5 >= 0) {
if (_board[_local5][_local3]){
trace(((((("collect to drop " + getQualifiedClassName(_board[_local5][_local3])) + " at ") + _local3) + ", ") + _local5));
_drop_list.push(new DropElement(_board[_local5][_local3], (_board[_local5][_local3].y + _cellh)));
_board[(_local5 + 1)][_local3] = _board[_local5][_local3];
_board[_local5][_local3] = null;
} else {
break;
};
_local5--;
};
};
if (_drop_list.length){
addEventListener(Event.ENTER_FRAME, animateDrop);
};
enabled = false;
checkLineCombos(_arg1);
}
function returnToMenu(_arg1:MouseEvent){
if (enabled){
Sfx.play(SfxClick);
parent.removeChild(this);
} else {
Sfx.play(SfxWrong);
};
}
function positionFieldMask(){
if (_level_col_height){
_fieldBackMask.y = (_bounds.y + ((_ih - _level_col_height) * _cellh));
} else {
_fieldBackMask.y = ((_bounds.y + (_cellh * _ih)) + 16);
};
}
function checkCombos(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:FlayoutText;
if (_cColorCombo.length >= _colorComboLen){
if (_cColorCombo.length > _colorComboLen){
trace(("ERORR COLOR COMBO ARRAY length " + _cColorCombo.length));
_cColorCombo.splice(0, (_cColorCombo.length - _colorComboLen));
};
trace(("COLOR COMBO ARRAY " + _cColorCombo));
_local1 = 1;
_local2 = (_cColorCombo.shift() as int);
for each (_local3 in _cColorCombo) {
if (_local3 == _local2){
_local1++;
};
};
if (_local1 == _colorComboLen){
_cColorCombo.splice(0, _cColorCombo.length);
Sfx.play(SfxBonus);
_local4 = new FlayoutText(_lastClickPt.x, (_lastClickPt.y + 10), ("Color Combo\n+" + _colorComboScore), 0xFFFF00, "Tahoma", 12, true);
addChild(_local4);
addScore(_colorComboScore);
(this[("ind_cc" + _local2)] as Sprite).alpha = 1;
_level_stats._color_combos++;
checkMegaBonus();
};
};
}
function checkLevelEnd(){
var _local1:int;
var _local2:Array;
var _local3:int;
var _local4:Class;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:Object;
var _local12:int;
var _local13:FlayoutText;
checkCombos();
for each (_local2 in _board) {
_local3 = 0;
while (_local3 < _local2.length) {
if (_local2[_local3]){
_local1 = 1;
_local4 = (getDefinitionByName(getQualifiedClassName(_local2[_local3])) as Class);
_local5 = (_local3 + 1);
while (_local5 < _local2.length) {
if ((_local2[_local5] is _local4)){
_local1++;
if (_local1 >= _match_min){
//unresolved jump
};
};
_local5++;
};
};
_local3++;
};
};
if (_local1 < _match_min){
_local6 = 0;
_local7 = 0;
_local8 = 0;
while (_local8 < _iw) {
_local6 = 0;
_local9 = (_ih - 1);
while (_local9 >= 0) {
if (_board[_local9][_local8]){
_local6++;
} else {
break;
};
_local9--;
};
if (_local7 < _local6){
_local7 = _local6;
};
_local8++;
};
if (_local7 > _level_col_height){
showGameOverDialog();
} else {
_local2 = _board[(_ih - 1)];
_local10 = 0;
for each (_local11 in _local2) {
if (_local11){
_local10++;
};
};
if (_local10 == 0){
_local12 = (_fullClearScoreMul * _score_pt);
addScore(_local12);
_local13 = new FlayoutText(0, ((_ih / 2) * _cellh), ("Full Clear +" + _local12.toString()), 0xFFFF00, "Tahoma", 12, true);
addChild(_local13);
_level_stats._full_clear = 1;
};
showLevelCompleteDialog();
};
} else {
trace(((((((((("continue cnt:" + _local1) + " on ") + _local3) + "...") + _local5) + " ") + _local4) + " row:") + _board.indexOf(_local2)));
enabled = true;
save();
};
}
}
}//package
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
class FlayoutText extends TextField {
private var _text:String;
private var _start_ms:int;
private var _format:TextFormat;
private var _speed:Number;// = 0.5
private var _delay_ms:int;// = 1500
private function FlayoutText(_arg1:Number, _arg2:Number, _arg3:String, _arg4:int, _arg5:String, _arg6:Number, _arg7:Boolean=true){
_speed = 0.5;
_delay_ms = 1500;
super();
_format = new TextFormat();
_format.color = _arg4;
_format.font = _arg5;
_format.bold = _arg7;
_format.size = _arg6;
_format.align = TextFormatAlign.CENTER;
autoSize = TextFieldAutoSize.CENTER;
text = _arg3;
setTextFormat(_format);
selectable = false;
mouseEnabled = false;
x = (_arg1 - (width / 2));
y = _arg2;
cacheAsBitmap = true;
_start_ms = getTimer();
addEventListener(Event.ENTER_FRAME, update);
}
private function remove(){
removeEventListener(Event.ENTER_FRAME, update);
if (parent){
parent.removeChild(this);
};
}
private function update(_arg1:Event):void{
if ((getTimer() - _start_ms) >= _delay_ms){
remove();
} else {
y = (y - _speed);
};
}
}
private const newArray2D:Function = function (_arg1:int, _arg2:int):Array{
var _local3:Array;
var _local4:int;
_local3 = new Array();
_local4 = 0;
while (_local4 < _arg2) {
_local3.push(new Array(_arg1));
_local4++;
};
return (_local3);
};
class DropElement {
private var _dest_y:Number;
private var _element:MovieClip;
private function DropElement(_arg1:MovieClip, _arg2:Number){
_element = _arg1;
_dest_y = _arg2;
}
}
Section 27
//LevelStats (LevelStats)
package {
public class LevelStats {
var _color_combos:int;
var _half_line_combos:int;
var _score:int;
var _full_clear:int;
var _full_line_combos:int;
function reset(){
_score = 0;
_color_combos = 0;
_full_line_combos = 0;
_half_line_combos = 0;
_full_clear = 0;
}
}
}//package
Section 28
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import mochi.*;
import flash.text.*;
import flash.utils.*;
import flash.net.*;
public dynamic class Main extends MovieClip {
var _loading_progress:CProgressbar;
public var dlg_noConnect:MovieClip;
public var dlg_play:MovieClip;
public var dlg_help:MovieClip;
var _isAdShown:Boolean;// = false
public var dlg_comment:MovieClip;
var _isADFailed:Boolean;// = false
public var bn_games:SimpleButton;
var _isAdStarted:Boolean;// = false
var _isLoaded:Boolean;// = false
public var dlg_options:DlgOptions;
public var bn_play:SimpleButton;
public var bn_help:SimpleButton;
public var bn_getgame:SimpleButton;
public var bn_comment:SimpleButton;
public var bn_scores:SimpleButton;
public var rating:MovieClip;
public var bn_rate1:SimpleButton;
public var bn_rate2:SimpleButton;
public var bn_rate3:SimpleButton;
public var bn_rate4:SimpleButton;
public var bn_rate5:SimpleButton;
public var bn_options:SimpleButton;
public var bn_logo:MovieClip;
public var bn_cancel:SimpleButton;
public var txt_thanks_voting:TextField;
var game:Game;
public static const HWIDTH:Number = 275;
public static const WIDTH:Number = 550;
public static const HEIGHT:Number = 400;
public static const MOCHIBOT_ID:String = "a528741a";
public static const HHEIGHT:Number = 200;
static var domains:Array = ["puzzlesea.com", "vladku.com", "flashgamelicense.com", "file:///E|/PRJ/Flash", "E:\\PRJ\\Flash", "E:/PRJ/Flash"];
public function Main(){
_isLoaded = false;
_isAdShown = false;
_isAdStarted = false;
_isADFailed = false;
super();
addFrameScript(0, frame1, 2, frame3, 3, frame4, 4, frame5);
stop();
_loading_progress = new CProgressbar(4, (HEIGHT - 10), (WIDTH - 8), 4, 3355545, 0xFFFFFF);
loaderInfo.addEventListener(Event.COMPLETE, onCompleteLoading);
MochiServices.connect("48b35d024989aa9b", root);
MochiAd.showPreGameAd({id:"48b35d024989aa9b", res:"550x400", clip:root, fadeout_time:1000, ad_failed:onADFailed, ad_started:onADStarted, ad_finished:onADFinished, no_bg:true});
}
function hideScores(){
gotoAndStop("menu");
}
function onLoadVotesError(_arg1:IOErrorEvent){
trace(("ERROR: " + _arg1.text));
}
function initPreloadLogo(){
Sprite(this["bn_logo"]).buttonMode = true;
Sprite(this["bn_logo"]).addEventListener(MouseEvent.CLICK, gotoMoreGamesPreload);
}
function set_rate_cookie(){
var _local1:SharedObject;
var _local2:Date;
var _local3:int;
var _local4:int;
var _local5:Number;
var _local6:int;
var _local7:int;
var _local8:int;
_local1 = SharedObject.getLocal("rate_me_limit");
_local2 = new Date();
_local3 = _local2.getFullYear();
_local4 = _local2.getMonth();
_local5 = _local2.getDate();
_local6 = _local2.getHours();
_local7 = _local2.getMinutes();
_local8 = _local2.getSeconds();
_local1.data.year = _local3;
_local1.data.month = _local4;
_local1.data.date = _local5;
_local1.data.hour = _local6;
_local1.data.min = _local7;
_local1.data.sec = _local8;
_local1.flush();
trace(_local1.data);
}
function submitScores(_arg1:int){
if (MochiServices.connected){
Sfx.play(SfxClick);
gotoAndStop("scores");
MochiScores.showLeaderboard({score:_arg1, boardID:"7af89f35e3d3517f", onClose:hideScores, onError:hideScores});
} else {
showDlgNotConnected();
};
}
function hideDlgNotConnected(_arg1:MouseEvent){
Sfx.play(SfxClick);
enable();
this["dlg_noConnect"].visible = false;
}
function frame3(){
initMenu();
}
function frame4(){
bn_cancel.addEventListener(MouseEvent.CLICK, cancelScores);
}
function frame5(){
initPreloadLogo();
}
function onLoadVotes(_arg1:Event){
var _local2:URLLoader;
var _local3:String;
var _local4:URLVariables;
var _local5:Number;
var _local6:Number;
var _local7:Number;
trace("onLoadVotes");
_local2 = URLLoader(_arg1.target);
_local2.removeEventListener(Event.COMPLETE, onLoadVotes);
trace(("load vars complete: " + _local2.data));
_local3 = _local2.data;
if (_local3.charAt(0) == "&"){
_local3 = _local3.slice(1, _local3.length);
};
trace(_local3);
_local4 = new URLVariables(_local3);
trace(("score " + _local4.score));
trace(("votes " + _local4.votes));
_local5 = _local4.score;
_local6 = (_local5 * 11.4);
_local7 = (Math.floor(_local5) * (20 - 11.4));
this["rating"]["mc_mask"].width = Math.round((_local6 + _local7));
}
function frame1(){
stop();
initPreloadLogo();
}
function showPlayDialog(){
disable();
this["dlg_play"].visible = true;
}
function showGame(_arg1:MouseEvent){
if (game){
showPlayDialog();
} else {
newGame(null);
};
Sfx.play(SfxClick);
}
public function initMenu(){
var i:int;
var so:SharedObject;
trace("begin initMenu");
get_rating();
this["dlg_options"].visible = false;
this["dlg_help"].visible = false;
this["dlg_play"].visible = false;
this["dlg_noConnect"].visible = false;
this["dlg_options"]["bn_close_options"].addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
root["dlg_options"].visible = false;
Sfx.play(SfxClick);
});
this["dlg_help"]["bn_close_help"].addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
root["dlg_help"].visible = false;
Sfx.play(SfxClick);
});
this["dlg_help"]["txt_site"].addEventListener(MouseEvent.CLICK, gotoGamePage);
this["dlg_noConnect"]["bn_close"].addEventListener(MouseEvent.CLICK, hideDlgNotConnected);
this["dlg_play"]["bn_continue"].addEventListener(MouseEvent.CLICK, continueGame);
this["dlg_play"]["bn_new"].addEventListener(MouseEvent.CLICK, newGame);
this["dlg_comment"].visible = false;
this["dlg_comment"]["bn_view"].addEventListener(MouseEvent.CLICK, showOnlineComments);
this["dlg_comment"]["bn_close"].addEventListener(MouseEvent.CLICK, hideDlgComments);
this["dlg_comment"]["fld_comment"].text = "";
this["dlg_comment"]["bn_submit"].addEventListener(MouseEvent.CLICK, onSubmitComment);
enable();
trace("end initMenu");
MochiBot.track(this, MOCHIBOT_ID);
i = domains.length;
while ((i = (i - 1)), i) {
if (loaderInfo.url.indexOf(domains[i]) > -1){
so = SharedObject.getLocal("game_progress");
if (so.data.game){
game = new Game();
game.load();
};
break;
};
};
}
function get_rating(){
var _local1:URLRequest;
var _local2:URLLoader;
_local1 = new URLRequest("http://www.mochibot.com/api/api-feedback.html");
_local1.data = ("mochibot_id=" + MOCHIBOT_ID);
_local1.method = URLRequestMethod.GET;
_local2 = new URLLoader();
_local2.addEventListener(Event.COMPLETE, onLoadVotes);
_local2.load(_local1);
}
function submit_vote(_arg1:String){
var _local2:URLRequest;
var _local3:URLLoader;
_local2 = new URLRequest("http://www.mochibot.com/api/api-feedback.html");
_local2.data = ("mochibot_id=" + MOCHIBOT_ID);
_local2.data = (_local2.data + ("&vote=" + _arg1));
_local2.method = URLRequestMethod.POST;
trace(((("sendToURL: " + _local2.url) + "?") + _local2.data));
_local3 = new URLLoader();
_local3.addEventListener(Event.COMPLETE, onLoadVotes);
_local3.load(_local2);
}
function showDlgComments(_arg1:MouseEvent){
Sfx.play(SfxClick);
disable();
this["dlg_comment"].visible = true;
}
function onADFinished(){
_isAdShown = true;
goToMenu();
}
function showOptions(_arg1:MouseEvent){
this["dlg_options"].visible = true;
this["bn_options"].enabled = false;
this["bn_scores"].enabled = false;
this["bn_play"].enabled = false;
Sfx.play(SfxClick);
}
function disable(){
SimpleButton(this["bn_help"]).enabled = false;
SimpleButton(this["bn_options"]).enabled = false;
SimpleButton(this["bn_scores"]).enabled = false;
SimpleButton(this["bn_play"]).enabled = false;
this["bn_comment"].enabled = false;
this["bn_games"].enabled = false;
SimpleButton(this["bn_options"]).removeEventListener(MouseEvent.CLICK, showOptions);
SimpleButton(this["bn_help"]).removeEventListener(MouseEvent.CLICK, showHelp);
SimpleButton(this["bn_play"]).removeEventListener(MouseEvent.CLICK, showGame);
SimpleButton(this["bn_scores"]).removeEventListener(MouseEvent.CLICK, showScores);
this["bn_comment"].removeEventListener(MouseEvent.CLICK, showDlgComments);
this["bn_games"].removeEventListener(MouseEvent.CLICK, gotoMoreGames);
this["bn_getgame"].removeEventListener(MouseEvent.CLICK, getThisGame);
if (is_rate_enabled()){
this["bn_rate1"].removeEventListener(MouseEvent.CLICK, onRate);
this["bn_rate1"].enabled = false;
this["bn_rate2"].removeEventListener(MouseEvent.CLICK, onRate);
this["bn_rate2"].enabled = false;
this["bn_rate3"].removeEventListener(MouseEvent.CLICK, onRate);
this["bn_rate3"].enabled = false;
this["bn_rate4"].removeEventListener(MouseEvent.CLICK, onRate);
this["bn_rate4"].enabled = false;
this["bn_rate5"].removeEventListener(MouseEvent.CLICK, onRate);
this["bn_rate5"].enabled = false;
this["txt_thanks_voting"].visible = false;
} else {
this["bn_rate1"].visible = false;
this["bn_rate2"].visible = false;
this["bn_rate3"].visible = false;
this["bn_rate4"].visible = false;
this["bn_rate5"].visible = false;
this["txt_thanks_voting"].visible = true;
};
Sprite(this["bn_logo"]).buttonMode = false;
Sprite(this["bn_logo"]).removeEventListener(MouseEvent.CLICK, gotoMoreGames);
}
function onADFailed(){
_isADFailed = true;
trace("AD FAILED");
}
function showDlgNotConnected(){
Sfx.play(SfxWrong);
this["dlg_noConnect"].visible = true;
disable();
}
function continueGame(_arg1:MouseEvent){
Sfx.play(SfxClick);
enable();
addChild(game);
this["dlg_play"].visible = false;
}
function cancelScores(_arg1:MouseEvent){
MochiScores.closeLeaderboard();
gotoAndStop("menu");
}
function submit_comment(_arg1:String, _arg2:String, _arg3:String=null){
var _local4:URLRequest;
var _local5:URLLoader;
_local4 = new URLRequest("http://www.mochibot.com/api/api-feedback.html");
_local4.data = ("mochibot_id=" + MOCHIBOT_ID);
_local4.data = (_local4.data + ("&comment=" + _arg1));
if (_arg2){
_local4.data = (_local4.data + ("&name=" + _arg2));
};
if (_arg3){
_local4.data = (_local4.data + ("&email=" + _arg3));
};
_local4.method = URLRequestMethod.POST;
_local5 = new URLLoader();
_local5.addEventListener(Event.COMPLETE, onLoadVotes);
_local5.load(_local4);
}
function hideDlgComments(_arg1:MouseEvent){
Sfx.play(SfxClick);
enable();
this["dlg_comment"].visible = false;
if (this["dlg_comment"]["bn_submit"].enabled == false){
this["dlg_comment"]["bn_submit"].enabled = true;
this["dlg_comment"]["bn_submit"].addEventListener(MouseEvent.CLICK, onSubmitComment);
};
}
function onRate(_arg1:Event){
var _local2:String;
set_rate_cookie();
_local2 = _arg1.target.name;
submit_vote(_local2.charAt((_local2.length - 1)));
this["bn_rate1"].visible = false;
this["bn_rate2"].visible = false;
this["bn_rate3"].visible = false;
this["bn_rate4"].visible = false;
this["bn_rate5"].visible = false;
this["txt_thanks_voting"].visible = true;
}
function showRate(_arg1:MouseEvent){
get_rating();
}
function goToMenu(){
if (((_isLoaded) && (_isAdShown))){
graphics.clear();
gotoAndStop("menu");
};
}
function enable(){
trace("1");
SimpleButton(this["bn_help"]).enabled = true;
trace("2");
SimpleButton(this["bn_options"]).enabled = true;
trace("3");
SimpleButton(this["bn_scores"]).enabled = true;
trace("4");
SimpleButton(this["bn_play"]).enabled = true;
trace("5");
this["bn_comment"].enabled = true;
trace("6");
this["bn_games"].enabled = true;
SimpleButton(this["bn_options"]).addEventListener(MouseEvent.CLICK, showOptions);
SimpleButton(this["bn_help"]).addEventListener(MouseEvent.CLICK, showHelp);
SimpleButton(this["bn_play"]).addEventListener(MouseEvent.CLICK, showGame);
SimpleButton(this["bn_scores"]).addEventListener(MouseEvent.CLICK, showScores);
this["bn_comment"].addEventListener(MouseEvent.CLICK, showDlgComments);
this["bn_games"].addEventListener(MouseEvent.CLICK, gotoMoreGames);
this["bn_getgame"].addEventListener(MouseEvent.CLICK, getThisGame);
if (is_rate_enabled()){
this["bn_rate1"].addEventListener(MouseEvent.CLICK, onRate);
this["bn_rate1"].enabled = true;
this["bn_rate2"].addEventListener(MouseEvent.CLICK, onRate);
this["bn_rate2"].enabled = true;
this["bn_rate3"].addEventListener(MouseEvent.CLICK, onRate);
this["bn_rate3"].enabled = true;
this["bn_rate4"].addEventListener(MouseEvent.CLICK, onRate);
this["bn_rate4"].enabled = true;
this["bn_rate5"].addEventListener(MouseEvent.CLICK, onRate);
this["bn_rate5"].enabled = true;
this["txt_thanks_voting"].visible = false;
} else {
this["bn_rate1"].visible = false;
this["bn_rate2"].visible = false;
this["bn_rate3"].visible = false;
this["bn_rate4"].visible = false;
this["bn_rate5"].visible = false;
this["txt_thanks_voting"].visible = true;
};
Sprite(this["bn_logo"]).buttonMode = true;
Sprite(this["bn_logo"]).addEventListener(MouseEvent.CLICK, gotoMoreGames);
}
function showScores(_arg1:MouseEvent){
if (MochiServices.connected){
Sfx.play(SfxClick);
gotoAndStop("scores");
MochiScores.showLeaderboard({boardID:"7af89f35e3d3517f", onClose:hideScores, onError:hideScores});
} else {
showDlgNotConnected();
};
}
private function updateLoadingProgress(_arg1:ProgressEvent):void{
var _local2:Number;
_local2 = Math.floor(((100 * _arg1.bytesLoaded) / _arg1.bytesTotal));
_loading_progress.draw(_local2, graphics);
}
function onSubmitComment(_arg1:MouseEvent){
if (this["dlg_comment"]["fld_comment"].text.length > 0){
Sfx.play(SfxClick);
submit_comment(this["dlg_comment"]["fld_comment"].text, this["dlg_comment"]["fld_name"].text);
this["dlg_comment"]["bn_submit"].enabled = false;
this["dlg_comment"]["bn_submit"].removeEventListener(MouseEvent.CLICK, onSubmitComment);
} else {
Sfx.play(SfxWrong);
};
}
function gotoMoreGamesPreload(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.puzzlesea.com/");
navigateToURL(_local2);
}
function newGame(_arg1:MouseEvent){
if (_arg1){
Sfx.play(SfxClick);
};
enable();
if (game){
game.free();
};
game = new Game();
game._soSave.clear();
addChild(game);
this["dlg_play"].visible = false;
}
function showOnlineComments(_arg1:MouseEvent){
var _local2:URLRequest;
Sfx.play(SfxClick);
_local2 = new URLRequest(("http://www.mochibot.com/shared/shared_feedback.html?swfid=" + MOCHIBOT_ID));
navigateToURL(_local2);
}
function is_rate_enabled():Boolean{
var _local1:SharedObject;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Date;
var _local9:Date;
var _local10:Number;
var _local11:Number;
_local1 = SharedObject.getLocal("rate_me_limit");
if (_local1.data.year){
_local2 = _local1.data.year;
_local3 = _local1.data.month;
_local4 = _local1.data.date;
_local5 = _local1.data.hour;
_local6 = _local1.data.min;
_local7 = _local1.data.sec;
_local8 = new Date(_local2, _local3, _local4, _local5, _local6, _local7);
_local9 = new Date();
_local10 = (_local9.getTime() - _local8.getTime());
_local11 = Math.floor((_local10 / 1000));
trace(("seconds after last vote " + _local11));
return ((_local11 >= 43200));
};
return (true);
}
function showHelp(_arg1:MouseEvent){
this["dlg_help"].visible = true;
Sfx.play(SfxClick);
}
function onADStarted(){
_isAdStarted = true;
trace("AD STARTED");
}
private function onCompleteLoading(_arg1:Event):void{
_isLoaded = true;
_loading_progress = null;
goToMenu();
}
public static function gotoGamePage(_arg1:MouseEvent){
var _local2:URLRequest;
Sfx.play(SfxClick);
_local2 = new URLRequest("http://www.puzzlesea.com/linyca/");
navigateToURL(_local2);
}
public static function getThisGame(_arg1:MouseEvent){
var _local2:URLRequest;
Sfx.play(SfxClick);
_local2 = new URLRequest("http://www.puzzlesea.com/puzzle/click/linyca/linyca.zip");
navigateToURL(_local2);
}
public static function gotoMoreGames(_arg1:MouseEvent){
var _local2:URLRequest;
Sfx.play(SfxClick);
_local2 = new URLRequest("http://www.puzzlesea.com/");
navigateToURL(_local2);
}
}
}//package
Section 29
//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.5");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
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_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var 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."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
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_failed();
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.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
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);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
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 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _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 _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 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 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;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
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 runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_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 _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 adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var 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 sendHostProgress:Boolean;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
setTimeout(options.ad_finished, 100);
return;
};
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_failed();
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);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
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.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
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;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _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)) || (!(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);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_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{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var 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 30
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.events.*;
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);
}
static function onLoadError(_arg1:IOErrorEvent){
trace(("IOError: " + _arg1.text));
}
}
}//package
Section 31
//MX (MX)
package {
import flash.display.*;
public class MX {
public static const rad2deg:Number = 57.2957795130823;
public static const deg2rad:Number = 0.0174532925199433;
public static function magnitudeByDeltas(_arg1:Number, _arg2:Number):Number{
return (Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2))));
}
public static function random(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + (Math.random() * (_arg2 - _arg1))));
}
public static function magnitude(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function angleToPos_rad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (Math.atan2((_arg4 - _arg2), (_arg3 - _arg1)));
}
public static function magnitudeApproxByDO(_arg1:DisplayObject, _arg2:DisplayObject):Number{
var _local3:Number;
var _local4:Number;
_local3 = Math.abs((_arg2.x - _arg1.x));
_local4 = Math.abs((_arg2.y - _arg1.y));
if (_local3 == 0){
return (_local4);
};
if (_local4 == 0){
return (_local3);
};
if (_local3 > _local4){
return (((_local4 * 0.41) + (_local3 * 0.941246)));
};
return (((_local3 * 0.41) + (_local4 * 0.941246)));
}
}
}//package
Section 32
//Sfx (Sfx)
package {
import flash.media.*;
public class Sfx {
public static function play(_arg1:Class){
var _local2:Sound;
if (BtnMute._isEnable){
_local2 = new (_arg1);
_local2.play();
};
}
}
}//package
Section 33
//SfxBonus (SfxBonus)
package {
import flash.media.*;
public dynamic class SfxBonus extends Sound {
}
}//package
Section 34
//SfxClick (SfxClick)
package {
import flash.media.*;
public class SfxClick extends Sound {
}
}//package
Section 35
//SfxComplete (SfxComplete)
package {
import flash.media.*;
public dynamic class SfxComplete extends Sound {
}
}//package
Section 36
//SfxGameOver (SfxGameOver)
package {
import flash.media.*;
public dynamic class SfxGameOver extends Sound {
}
}//package
Section 37
//SfxMegaBonus (SfxMegaBonus)
package {
import flash.media.*;
public dynamic class SfxMegaBonus extends Sound {
}
}//package
Section 38
//SfxRemove1 (SfxRemove1)
package {
import flash.media.*;
public dynamic class SfxRemove1 extends Sound {
}
}//package
Section 39
//SfxRemove2 (SfxRemove2)
package {
import flash.media.*;
public dynamic class SfxRemove2 extends Sound {
}
}//package
Section 40
//SfxRemove3 (SfxRemove3)
package {
import flash.media.*;
public dynamic class SfxRemove3 extends Sound {
}
}//package
Section 41
//SfxRemove4 (SfxRemove4)
package {
import flash.media.*;
public dynamic class SfxRemove4 extends Sound {
}
}//package
Section 42
//SfxRemove5 (SfxRemove5)
package {
import flash.media.*;
public dynamic class SfxRemove5 extends Sound {
}
}//package
Section 43
//SfxRemove6 (SfxRemove6)
package {
import flash.media.*;
public dynamic class SfxRemove6 extends Sound {
}
}//package
Section 44
//SfxRemove7 (SfxRemove7)
package {
import flash.media.*;
public dynamic class SfxRemove7 extends Sound {
}
}//package
Section 45
//SfxRemove8 (SfxRemove8)
package {
import flash.media.*;
public dynamic class SfxRemove8 extends Sound {
}
}//package
Section 46
//SfxRemove9 (SfxRemove9)
package {
import flash.media.*;
public dynamic class SfxRemove9 extends Sound {
}
}//package
Section 47
//SfxWrong (SfxWrong)
package {
import flash.media.*;
public dynamic class SfxWrong extends Sound {
}
}//package