Section 1
//AddToSite_30 (fly_smash_arcade_free_online_games_fla.AddToSite_30)
package fly_smash_arcade_free_online_games_fla {
import flash.display.*;
import flash.text.*;
public dynamic class AddToSite_30 extends MovieClip {
public var html_text:TextField;
public var backToMain:SimpleButton;
public function AddToSite_30(){
addFrameScript(32, frame33);
}
function frame33(){
stop();
}
}
}//package fly_smash_arcade_free_online_games_fla
Section 2
//Credits_28 (fly_smash_arcade_free_online_games_fla.Credits_28)
package fly_smash_arcade_free_online_games_fla {
import flash.display.*;
public dynamic class Credits_28 extends MovieClip {
public var backToMain:SimpleButton;
public function Credits_28(){
addFrameScript(32, frame33);
}
function frame33(){
stop();
}
}
}//package fly_smash_arcade_free_online_games_fla
Section 3
//Highscores_27 (fly_smash_arcade_free_online_games_fla.Highscores_27)
package fly_smash_arcade_free_online_games_fla {
import flash.display.*;
public dynamic class Highscores_27 extends MovieClip {
public var threeMinRun:SimpleButton;
public var survival:SimpleButton;
public var backToMain:SimpleButton;
public var oneMinRun:SimpleButton;
public function Highscores_27(){
addFrameScript(32, frame33);
}
function frame33(){
stop();
}
}
}//package fly_smash_arcade_free_online_games_fla
Section 4
//MainMenu_10 (fly_smash_arcade_free_online_games_fla.MainMenu_10)
package fly_smash_arcade_free_online_games_fla {
import flash.display.*;
public dynamic class MainMenu_10 extends MovieClip {
public var highscores:SimpleButton;
public var addToSite:SimpleButton;
public var moreGames:SimpleButton;
public var playGame:SimpleButton;
public var credits:SimpleButton;
public function MainMenu_10(){
addFrameScript(44, frame45);
}
function frame45(){
stop();
}
}
}//package fly_smash_arcade_free_online_games_fla
Section 5
//MainTimeline (fly_smash_arcade_free_online_games_fla.MainTimeline)
package fly_smash_arcade_free_online_games_fla {
import flash.display.*;
import flash.events.*;
import mochi.as3.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.geom.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var gameMode1:uint;
public var music:Music1;
public var gameField:Sprite;
public var clocky:Clocky;
public var fliesMissed:uint;
public var addToSite:MovieClip;
public var missedUI:MissedUI;
public var startTime:Number;
public var intro:MovieClip;
public var seconds:uint;
public var creditsField:MovieClip;
public var fly:Array;
public var periodic;
public var messageArray:Array;
public var scoreUI:ScoreUI;
public var butterfly:Array;
public var flySwat:FlySwat;
public var gameMode:uint;
public var mainMenu:MovieClip;
public var score:uint;
public var domain:String;
public var gameBackground:MovieClip;
public var time:uint;
public var minutes:uint;
public var age:Array;
public var siteLock:MovieClip;
public var musicChannel:SoundChannel;
public var survival:Boolean;
public var highscoreSelect:MovieClip;
public var layer:Array;
public var smackHit:SwatHit;
public var deadFly:Array;
public var pauzed:Boolean;
public var copyrightNotice:ContextMenuItem;
public var fliesHit:uint;
public var allowed_site:String;
public var smackMiss:SwatMiss;
public var missesAllowed:uint;
public var contextBytesizedLink:ContextMenuItem;
public var context:ContextMenu;
public var difficulty:Number;
public var fliesSpawned:uint;
public var gameTime:int;
public var selectLevel:MovieClip;
public var framesPerSecond:uint;
public var moreGamesField:MovieClip;
public var contextFastGamesLink:ContextMenuItem;
public var gamePlaying:Boolean;
public var baseSpeed:Array;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14);
}
public function clearAll(){
musicChannel.stop();
clearInterval(periodic);
gameBackground.removeChild(gameField);
gameField = null;
}
public function goSponsorSitelock(_arg1:MouseEvent){
var url:String;
var request:URLRequest;
var event = _arg1;
url = "http://www.bytesizedarcade.com/";
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
public function scoreThreeMinRun(_arg1:MouseEvent){
gameMode1 = 2;
showScores1();
}
public function developerSite(_arg1:MouseEvent){
var url:String;
var request:URLRequest;
var event = _arg1;
url = "http://www.bytesizedarcade.com/";
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
public function increaseTime(_arg1:TimerEvent):void{
var _local2:*;
var _local3:Number;
var _local4:Point;
var _local5:Boolean;
if (gamePlaying){
time++;
};
updateTime();
_local2 = 0;
while (_local2 < fly.length) {
_local3 = (baseSpeed[_local2] * 3);
_local4 = Point.polar(_local3, ((((fly[_local2].rotation - 90) * 2) * Math.PI) / 360));
_local5 = false;
if ((((fly[_local2].x < -15)) && ((_local4.x < 0)))){
_local5 = true;
} else {
if ((((fly[_local2].y < -15)) && ((_local4.y < 0)))){
_local5 = true;
} else {
if ((((fly[_local2].y > 495)) && ((_local4.y > 0)))){
_local5 = true;
} else {
if ((((fly[_local2].x > 655)) && ((_local4.x > 0)))){
_local5 = true;
};
};
};
};
if (_local5){
if (((survival) && (gamePlaying))){
fliesMissed++;
showFliesMissed(fly[_local2].x, fly[_local2].y, _local2);
if (fliesMissed == missesAllowed){
finishGame();
gamePlaying = false;
_arg1.currentTarget.removeEventListener("timer", increaseTime);
};
};
layer[2].removeChild(fly[_local2]);
fly.splice(_local2, 1);
baseSpeed.splice(_local2, 1);
if ((((fly.length < 4)) && (gamePlaying))){
randomFly();
};
};
_local2++;
};
_local2 = 0;
while (_local2 < butterfly.length) {
_local4 = Point.polar(1, ((((butterfly[_local2].rotation - 90) * 2) * Math.PI) / 360));
if ((((butterfly[_local2].x < -30)) && ((_local4.x < 0)))){
butterfly[_local2].rotation = (butterfly[_local2].rotation + (180 + (60 * (Math.random() - 0.5))));
} else {
if ((((butterfly[_local2].x > 670)) && ((_local4.x > 0)))){
butterfly[_local2].rotation = (butterfly[_local2].rotation + (180 + (60 * (Math.random() - 0.5))));
} else {
if ((((butterfly[_local2].y < -30)) && ((_local4.y < 0)))){
butterfly[_local2].rotation = (butterfly[_local2].rotation + (180 + (60 * (Math.random() - 0.5))));
} else {
if ((((butterfly[_local2].y > 510)) && ((_local4.y > 0)))){
butterfly[_local2].rotation = (butterfly[_local2].rotation + (180 + (60 * (Math.random() - 0.5))));
};
};
};
};
_local2++;
};
_local2 = 0;
while (_local2 < deadFly.length) {
if (deadFly[_local2].y > 500){
layer[2].removeChild(deadFly[_local2]);
deadFly.splice(_local2, 1);
};
_local2++;
};
if ((((time == gameTime)) && (gamePlaying))){
finishGame();
gamePlaying = false;
_arg1.currentTarget.removeEventListener("timer", increaseTime);
};
}
public function spawnFirstFly(_arg1:TimerEvent):void{
spawnFly();
}
function frame14(){
stop();
addToSite.html_text.htmlText = "<a href='http://cdn.mochiads.com/c/g/fly-smash-arcade.zip' target='_blank'>Alternatively click here to download a zipfile with the swf-file and avatar.</a>";
addToSite.html_text.selectable = false;
addToSite.html_text.textColor = 0x333333;
addToSite.backToMain.addEventListener(MouseEvent.CLICK, backToMain5);
}
public function backToMenu(_arg1:MouseEvent){
clearAll();
gotoAndStop("frm_menu");
}
public function goAddToSite(_arg1:MouseEvent){
removeMenuListeners();
gotoAndStop("frm_add_to_site");
}
function frame2(){
stop();
intro.mouseChildren = false;
intro.buttonMode = true;
intro.addEventListener(MouseEvent.CLICK, goSponsor);
intro.addEventListener(Event.ENTER_FRAME, checkFrame);
}
function frame3(){
stop();
mainMenu.playGame.addEventListener(MouseEvent.CLICK, goLevelSelect);
mainMenu.highscores.addEventListener(MouseEvent.CLICK, goHighscores);
mainMenu.moreGames.addEventListener(MouseEvent.CLICK, goMoreGames);
mainMenu.credits.addEventListener(MouseEvent.CLICK, goCredits);
mainMenu.addToSite.addEventListener(MouseEvent.CLICK, goAddToSite);
}
public function goMenu(){
intro.removeEventListener(MouseEvent.CLICK, goSponsor);
intro.removeEventListener(Event.ENTER_FRAME, checkFrame);
gotoAndStop("frm_menu");
}
function frame5(){
stop();
moreGamesField.sponsor.addEventListener(MouseEvent.CLICK, sponsorSite);
moreGamesField.developer.addEventListener(MouseEvent.CLICK, developerSite);
moreGamesField.backToMain.addEventListener(MouseEvent.CLICK, backToMain3);
}
function frame7(){
framesPerSecond = 30;
missesAllowed = 25;
gameField = new Sprite();
layer = new Array();
fly = new Array();
age = new Array();
baseSpeed = new Array();
deadFly = new Array();
butterfly = new Array();
flySwat = new FlySwat();
clocky = new Clocky();
scoreUI = new ScoreUI();
missedUI = new MissedUI();
messageArray = new Array();
score = 0;
time = 0;
difficulty = 0;
minutes = 0;
seconds = 0;
pauzed = false;
gamePlaying = true;
startTime = getTimer();
fliesSpawned = 0;
fliesHit = 0;
fliesMissed = 0;
smackHit = new SwatHit();
smackMiss = new SwatMiss();
music = new Music1();
initialize();
periodic = setInterval(periodicFunction, (1000 / framesPerSecond));
}
public function goMoreGames(_arg1:MouseEvent){
removeMenuListeners();
gotoAndStop("frm_more_games");
}
public function startThreeMinRun(_arg1:MouseEvent){
gameMode = 2;
startGame();
}
function frame4(){
stop();
selectLevel.oneMinRun.addEventListener(MouseEvent.CLICK, startOneMinRun);
selectLevel.threeMinRun.addEventListener(MouseEvent.CLICK, startThreeMinRun);
selectLevel.survival.addEventListener(MouseEvent.CLICK, startSurvival);
selectLevel.backToMain.addEventListener(MouseEvent.CLICK, backToMain1);
}
function frame12(){
gotoAndStop("frm_show_score");
}
public function scoreOneMinRun(_arg1:MouseEvent){
gameMode1 = 1;
showScores1();
}
public function moreGames(_arg1:MouseEvent){
var url:String;
var request:URLRequest;
var event = _arg1;
url = "http://www.fastgames-online.com/";
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
function frame8(){
gotoAndStop("frm_inter_ad");
}
function frame9(){
if (gameMode == 1){
MochiScores.showLeaderboard({boardID:"c702fbd1384ac52f", score:score, res:"640x480"});
} else {
if (gameMode == 2){
MochiScores.showLeaderboard({boardID:"56fe3c8606d61452", score:score, res:"640x480"});
} else {
if (gameMode == 3){
MochiScores.showLeaderboard({boardID:"7ce08582c30c8cca", score:score, res:"640x480"});
};
};
};
}
function frame1(){
allowed_site = "freeonlinegames";
domain = this.root.loaderInfo.url.split("/")[2];
if (domain.search(allowed_site) <= -1){
stop();
siteLock.mouseChildren = false;
siteLock.buttonMode = true;
siteLock.addEventListener(MouseEvent.CLICK, goSponsorSitelock);
} else {
siteLock.visible = false;
};
stage.scaleMode = StageScaleMode.SHOW_ALL;
MochiServices.connect("f4fd6818a3da73b1", root, onConnectError);
copyrightNotice = new ContextMenuItem("Copyright © 2009 Bytesized Arcade");
contextBytesizedLink = new ContextMenuItem("Go to BytesizedArcade.com");
contextFastGamesLink = new ContextMenuItem("More Games on FastGames-Online.com");
copyrightNotice.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, deadClick);
contextFastGamesLink.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, contextFastGames);
contextBytesizedLink.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, contextBytesized);
contextFastGamesLink.separatorBefore = true;
contextBytesizedLink.separatorBefore = false;
context = new ContextMenu();
context.hideBuiltInItems();
context.customItems.push(copyrightNotice, contextBytesizedLink, contextFastGamesLink, contextBytesizedLink);
this.contextMenu = context;
}
public function playAgain(_arg1:MouseEvent){
clearAll();
gotoAndStop("frm_restart");
}
public function goCredits(_arg1:MouseEvent){
removeMenuListeners();
gotoAndStop("frm_credits");
}
public function startOneMinRun(_arg1:MouseEvent){
gameMode = 1;
startGame();
}
function frame13(){
stop();
creditsField.backToMain.addEventListener(MouseEvent.CLICK, backToMain4);
}
function frame10(){
gotoAndStop("frm_inter_ad");
}
public function randomFly(){
spawnFly();
}
public function showScores1(){
removeListeners2();
highscoreSelect.visible = false;
if (gameMode1 == 1){
MochiScores.showLeaderboard({boardID:"c702fbd1384ac52f", res:"640x480"});
} else {
if (gameMode1 == 2){
MochiScores.showLeaderboard({boardID:"56fe3c8606d61452", res:"640x480"});
} else {
if (gameMode1 == 3){
MochiScores.showLeaderboard({boardID:"7ce08582c30c8cca", res:"640x480"});
};
};
};
}
public function onConnectError(_arg1:String){
}
public function swatUp(_arg1:MouseEvent){
flySwat.scaleX = 1;
flySwat.scaleY = 1;
}
public function calculateScore(_arg1:uint, _arg2:Number){
var _local3:uint;
var _local4:uint;
var _local5:*;
var _local6:uint;
_local3 = 5;
_local4 = Math.abs((5 * Math.ceil((Math.max(0, (15 - (age[_arg1] / 5))) / 5))));
_local5 = Math.abs((5 * Math.round((Math.min(10, _arg2) / 5))));
_local6 = _local3;
age.splice(_arg1, 1);
return (_local6);
}
function frame11(){
stop();
highscoreSelect.visible = true;
highscoreSelect.oneMinRun.addEventListener(MouseEvent.CLICK, scoreOneMinRun);
highscoreSelect.threeMinRun.addEventListener(MouseEvent.CLICK, scoreThreeMinRun);
highscoreSelect.survival.addEventListener(MouseEvent.CLICK, scoreSurvival);
highscoreSelect.backToMain.addEventListener(MouseEvent.CLICK, backToMain2);
}
public function contextFastGames(_arg1:MouseEvent){
var url:String;
var request:URLRequest;
var event = _arg1;
url = "http://www.fastgames-online.com/";
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
public function swatDown(_arg1:MouseEvent){
var _local2:uint;
var _local3:uint;
var _local4:Boolean;
var _local5:*;
var _local6:BlurFilter;
var _local7:Array;
var _local8:Array;
var _local9:Number;
var _local10:Point;
_local2 = 0;
_local3 = 0;
_local4 = false;
_local5 = (fly.length - 1);
while (_local5 >= 0) {
if (flySwat.collisionBox.hitTestPoint(fly[_local5].x, fly[_local5].y, true)){
_local6 = new BlurFilter(0, 3);
_local7 = [_local6];
_local8 = fly.splice(_local5, 1);
_local8[0].stop();
_local8[0].cacheAsBitmap = true;
_local8[0].filters = _local7;
_local8[0].rotation = (_local8[0].rotation % 360);
_local9 = baseSpeed.splice(_local5, 1);
deadFly.push(_local8[0]);
fliesHit++;
_local2++;
if (survival == false){
_local3 = (_local3 + calculateScore(_local5, _local9));
};
if ((((time == gameTime)) || ((fliesMissed == missesAllowed)))){
finishGame();
gamePlaying = false;
};
if ((((fly.length < 4)) && (gamePlaying))){
randomFly();
};
_local4 = true;
};
_local5--;
};
if ((((survival == false)) && ((_local2 > 0)))){
_local10 = new Point();
_local5 = (deadFly.length - 1);
while (_local5 >= (deadFly.length - _local2)) {
_local10.x = (_local10.x + deadFly[_local5].x);
_local10.y = (_local10.y + deadFly[_local5].y);
_local5--;
};
_local10.x = (_local10.x / _local2);
_local10.y = (_local10.y / _local2);
showScore(_local10.x, _local10.y, _local2, _local3);
};
flySwat.scaleX = 0.96;
flySwat.scaleY = 0.96;
if (_local4){
smackHit.play();
} else {
smackMiss.play();
};
}
public function backToMain1(_arg1:MouseEvent){
removeListeners1();
gotoAndStop("frm_menu");
}
public function backToMain2(_arg1:MouseEvent){
removeListeners2();
gotoAndStop("frm_menu");
}
public function backToMain3(_arg1:MouseEvent){
removeListeners3();
gotoAndStop("frm_menu");
}
public function backToMain4(_arg1:MouseEvent){
creditsField.backToMain.removeEventListener(MouseEvent.CLICK, backToMain4);
gotoAndStop("frm_menu");
}
public function backToMain5(_arg1:MouseEvent){
addToSite.backToMain.removeEventListener(MouseEvent.CLICK, backToMain5);
trace(1);
gotoAndStop("frm_menu");
}
public function goSponsor(_arg1:MouseEvent){
var url:String;
var request:URLRequest;
var event = _arg1;
url = "http://www.fastgames-online.com/";
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
goMenu();
}
public function spawnFly(){
var _local1:Fly;
var _local2:Point;
_local1 = new Fly();
_local1.scaleX = ((Math.random() * 0.2) + 0.2);
_local1.scaleY = _local1.scaleX;
_local1.rotation = (Math.random() * 360);
baseSpeed.push((((_local1.scaleX * 2) + 0.5) + (((Math.sqrt(time) / 8) * 50) / framesPerSecond)));
_local2 = Point.polar(1, ((((_local1.rotation - 90) * 2) * Math.PI) / 360));
if (Math.abs(_local2.x) > Math.abs(_local2.y)){
_local1.y = (Math.random() * 370);
if (_local2.x > 0){
_local1.x = -10;
} else {
_local1.x = 650;
};
} else {
if (Math.abs(_local2.x) < Math.abs(_local2.y)){
if (_local2.y > 0){
_local1.x = (Math.random() * 640);
_local1.y = -10;
} else {
_local1.x = (40 + (Math.random() * 560));
_local1.y = 490;
};
};
};
fly.push(_local1);
age.push(0);
layer[2].addChild(fly[(fly.length - 1)]);
fliesSpawned++;
}
public function removeMessage(_arg1:TimerEvent){
layer[3].removeChild(messageArray[0]);
messageArray.shift();
_arg1.currentTarget.removeEventListener("timer", removeMessage);
}
public function finishGame(){
var _local1:GameOver;
var _local2:Number;
stage.removeEventListener(MouseEvent.MOUSE_DOWN, swatDown);
stage.removeEventListener(MouseEvent.MOUSE_UP, swatUp);
if (survival){
_local2 = (getTimer() - startTime);
score = _local2;
};
_local1 = new GameOver();
_local1.submitScore.addEventListener(MouseEvent.CLICK, submitScore);
_local1.moreGames.addEventListener(MouseEvent.CLICK, moreGames);
_local1.playAgain.addEventListener(MouseEvent.CLICK, playAgain);
_local1.backToMenu.addEventListener(MouseEvent.CLICK, backToMenu);
layer[3].removeChild(flySwat);
layer[3].addChild(_local1);
}
public function showFliesMissed(_arg1:Number, _arg2:Number, _arg3:uint){
_arg1 = Math.min(620, Math.max(20, _arg1));
_arg2 = Math.min(460, Math.max(20, _arg2));
missedUI.scoreText.text = ((String(fliesMissed) + "/") + String(missesAllowed));
age.splice(_arg3, 1);
}
public function spawnButterfly(){
var _local1:Number;
var _local2:BlurFilter;
var _local3:Array;
var _local4:*;
_local1 = Math.random();
if (_local1 < (1 / 3)){
_local4 = new Butterfly1();
} else {
if (_local1 < (2 / 3)){
_local4 = new Butterfly2();
} else {
_local4 = new Butterfly3();
};
};
_local2 = new BlurFilter(2, 2);
_local3 = [_local2];
_local4.x = (Math.random() * 640);
_local4.y = (Math.random() * 480);
_local4.scaleX = ((Math.random() * 0.1) + 0.1);
_local4.scaleY = _local4.scaleX;
_local4.rotation = (Math.random() * 360);
_local4.filters = _local3;
butterfly.push(_local4);
layer[1].addChild(butterfly[(butterfly.length - 1)]);
}
public function updateTime(){
var _local1:uint;
var _local2:uint;
var _local3:String;
var _local4:Number;
if (survival){
_local1 = Math.floor((time / 60));
_local2 = (Math.floor(time) % 60);
} else {
_local4 = Math.max(0, (gameTime - time));
_local1 = Math.floor((_local4 / 60));
_local2 = (Math.floor(_local4) % 60);
};
minutes = _local1;
seconds = _local2;
if (seconds < 10){
_local3 = ("0" + String(seconds));
} else {
_local3 = String(seconds);
};
clocky.timeText.text = ((String(minutes) + ":") + _local3);
}
public function checkFrame(_arg1:Event){
if (intro.currentFrame >= intro.totalFrames){
goMenu();
};
}
public function goHighscores(_arg1:MouseEvent){
removeMenuListeners();
gotoAndStop("frm_show_score");
}
public function submitScore(_arg1:MouseEvent){
clearAll();
gotoAndStop("frm_post_score");
}
public function sendMessage(_arg1:Number, _arg2:Number, _arg3:String){
var _local4:Message;
var _local5:Timer;
_local4 = new Message();
_local4.x = _arg1;
_local4.y = _arg2;
_local4.messageText.text = _arg3;
_local4.messageText.selectable = false;
messageArray.push(_local4);
layer[3].addChild(messageArray[(messageArray.length - 1)]);
_local5 = new Timer(1000, 1);
_local5.addEventListener("timer", removeMessage);
_local5.start();
}
public function removeListeners1(){
selectLevel.oneMinRun.removeEventListener(MouseEvent.CLICK, startOneMinRun);
selectLevel.threeMinRun.removeEventListener(MouseEvent.CLICK, startThreeMinRun);
selectLevel.survival.removeEventListener(MouseEvent.CLICK, startSurvival);
selectLevel.backToMain.removeEventListener(MouseEvent.CLICK, backToMain1);
}
public function removeListeners2(){
highscoreSelect.oneMinRun.removeEventListener(MouseEvent.CLICK, scoreOneMinRun);
highscoreSelect.threeMinRun.removeEventListener(MouseEvent.CLICK, scoreThreeMinRun);
highscoreSelect.survival.removeEventListener(MouseEvent.CLICK, scoreSurvival);
highscoreSelect.backToMain.removeEventListener(MouseEvent.CLICK, backToMain2);
}
public function removeListeners3(){
moreGamesField.sponsor.removeEventListener(MouseEvent.CLICK, sponsorSite);
moreGamesField.developer.removeEventListener(MouseEvent.CLICK, developerSite);
moreGamesField.backToMain.removeEventListener(MouseEvent.CLICK, backToMain3);
}
public function startGame(){
if (gameMode == 1){
gameTime = 60;
survival = false;
} else {
if (gameMode == 2){
gameTime = 180;
survival = false;
} else {
if (gameMode == 3){
gameTime = -1;
survival = true;
};
};
};
removeListeners1();
gotoAndStop("frm_game");
}
public function removeMenuListeners(){
mainMenu.playGame.removeEventListener(MouseEvent.CLICK, goLevelSelect);
}
public function sponsorSite(_arg1:MouseEvent){
var url:String;
var request:URLRequest;
var event = _arg1;
url = "http://www.fastgames-online.com/";
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
public function deadClick(_arg1:ContextMenuEvent){
}
public function initialize(){
var _local1:*;
var _local2:*;
var _local3:Timer;
var _local4:Timer;
var _local5:Sprite;
stop();
gameBackground.addChild(gameField);
_local1 = 0;
while (_local1 < 4) {
_local5 = new Sprite();
layer.push(_local5);
gameField.addChild(layer[_local1]);
_local1++;
};
_local2 = new BackgroundGradient();
layer[0].addChild(_local2);
_local2 = new Garden1();
layer[0].addChild(_local2);
_local2 = new Window1();
layer[2].addChild(_local2);
layer[3].addChild(flySwat);
clocky.x = 50;
clocky.y = 379;
layer[2].addChild(clocky);
if (survival){
missedUI.x = 50;
missedUI.y = 50;
missedUI.scoreText.text = ((String(fliesMissed) + "/") + String(missesAllowed));
layer[2].addChild(missedUI);
} else {
scoreUI.x = 50;
scoreUI.y = 50;
scoreUI.scoreText.text = "0";
layer[2].addChild(scoreUI);
};
spawnFly();
_local3 = new Timer(1000, 2);
_local3.addEventListener("timer", spawnFirstFly);
_local3.start();
_local1 = 0;
while (_local1 < 4) {
spawnButterfly();
_local1++;
};
stage.addEventListener(MouseEvent.MOUSE_DOWN, swatDown);
stage.addEventListener(MouseEvent.MOUSE_UP, swatUp);
updateTime();
_local4 = new Timer(1000, 0);
_local4.addEventListener("timer", increaseTime);
_local4.start();
musicChannel = music.play(0, int.MAX_VALUE);
musicChannel.soundTransform = new SoundTransform(1.2, 0);
}
public function showScore(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:uint){
var _local5:uint;
_local5 = 0;
if (_arg3 > 2){
_local5 = 25;
} else {
if (_arg3 == 2){
_local5 = 10;
};
};
score = ((score + _local5) + _arg4);
sendMessage(_arg1, _arg2, ("+" + String((_local5 + _arg4))));
scoreUI.scoreText.text = String(score);
}
public function goLevelSelect(_arg1:MouseEvent){
removeMenuListeners();
gotoAndStop("frm_select_level");
}
public function contextBytesized(_arg1:ContextMenuEvent){
var url:String;
var request:URLRequest;
var event = _arg1;
url = "http://www.bytesizedarcade.com/";
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
public function periodicFunction(){
var _local1:*;
var _local2:Number;
var _local3:Point;
flySwat.rotation = ((stage.mouseX - flySwat.x) / 5);
flySwat.x = stage.mouseX;
flySwat.y = stage.mouseY;
_local1 = 0;
while (_local1 < fly.length) {
fly[_local1].rotation = (((fly[_local1].rotation + 1080) + (5 * (Math.random() - 0.5))) % 360);
_local2 = (baseSpeed[_local1] * 3);
_local3 = Point.polar(_local2, ((((fly[_local1].rotation - 90) * 2) * Math.PI) / 360));
fly[_local1].x = (fly[_local1].x + _local3.x);
fly[_local1].y = (fly[_local1].y + _local3.y);
var _local4 = age;
var _local5 = _local1;
var _local6 = (_local4[_local5] + 1);
_local4[_local5] = _local6;
_local1++;
};
_local1 = 0;
while (_local1 < deadFly.length) {
deadFly[_local1].y = (deadFly[_local1].y + 9);
if (deadFly[_local1].rotation > 0){
deadFly[_local1].rotation = (deadFly[_local1].rotation + 3);
} else {
if (deadFly[_local1].rotation < 0){
deadFly[_local1].rotation = (deadFly[_local1].rotation - 3);
};
};
_local1++;
};
_local1 = 0;
while (_local1 < butterfly.length) {
butterfly[_local1].rotation = (butterfly[_local1].rotation + (30 * (Math.random() - 0.5)));
_local2 = (Math.random() + 1);
_local3 = Point.polar(_local2, ((((butterfly[_local1].rotation - 90) * 2) * Math.PI) / 360));
butterfly[_local1].x = (butterfly[_local1].x + _local3.x);
butterfly[_local1].y = (butterfly[_local1].y + _local3.y);
_local1++;
};
}
public function startSurvival(_arg1:MouseEvent){
gameMode = 3;
startGame();
}
public function scoreSurvival(_arg1:MouseEvent){
gameMode1 = 3;
showScores1();
}
}
}//package fly_smash_arcade_free_online_games_fla
Section 6
//MoreGames_23 (fly_smash_arcade_free_online_games_fla.MoreGames_23)
package fly_smash_arcade_free_online_games_fla {
import flash.display.*;
public dynamic class MoreGames_23 extends MovieClip {
public var sponsor:SimpleButton;
public var backToMain:SimpleButton;
public var developer:SimpleButton;
public function MoreGames_23(){
addFrameScript(32, frame33);
}
function frame33(){
stop();
}
}
}//package fly_smash_arcade_free_online_games_fla
Section 7
//SelectGame_17 (fly_smash_arcade_free_online_games_fla.SelectGame_17)
package fly_smash_arcade_free_online_games_fla {
import flash.display.*;
public dynamic class SelectGame_17 extends MovieClip {
public var threeMinRun:SimpleButton;
public var survival:SimpleButton;
public var backToMain:SimpleButton;
public var oneMinRun:SimpleButton;
public function SelectGame_17(){
addFrameScript(32, frame33);
}
function frame33(){
stop();
}
}
}//package fly_smash_arcade_free_online_games_fla
Section 8
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function reencode():void{
var _local1:uint;
_local1 = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String;
_local1 = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function get value():Number{
return (Number(this.toString()));
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String;
_local3 = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 9
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
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 n:Number;
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;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
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;
};
};
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
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{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
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.as3
Section 10
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.geom.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__ms_";
private static var _servicesURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
public static var netup:Boolean = true;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
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);
};
};
};
};
};
}
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++;
};
};
}
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);
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local3:Array;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:MovieClip;
var _local8:LocalConnection;
var _local9:String;
var _local10:ByteArray;
var _local11:ByteArray;
var _local12:uint;
var _local13:uint;
var _local14:Loader;
_local3 = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
_local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
_local6 = [0, 64, 0, 0, 0];
_local7 = new MovieClip();
_local8 = new LocalConnection();
_local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().getTime()));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
_local10 = new ByteArray();
_local11 = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
_local12 = ((_local3.length + _local11.length) + 4);
_local13 = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
vars = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
var _local2:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
_local2 = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
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();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.0");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
public static function get id():String{
return (_id);
}
private static function urlOptions(_arg1:Object):Object{
var _local2:Object;
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
_local2 = {};
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
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 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) {
};
};
};
};
}
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(), parentURL:_container.loaderInfo.loaderURL});
_listenChannel.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");
};
trace("connected!");
_connecting = false;
_connected = true;
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...");
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var vars:URLVariables;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(clip).servicesURL != undefined){
_servicesURL = urlOptions(clip).servicesURL;
};
MochiServices.allowDomains(_servicesURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor((Math.random() * 99999))));
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_servicesURL);
vars = new URLVariables();
vars.listenLC = _listenChannelName;
vars.mochiad_options = clip.loaderInfo.parameters.mochiad_options;
if (widget){
vars.widget = true;
};
req.data = vars;
listen();
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function get clip():Object{
return (_container);
}
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 (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 11
//BackgroundGradient (BackgroundGradient)
package {
import flash.display.*;
public dynamic class BackgroundGradient extends MovieClip {
}
}//package
Section 12
//Butterfly1 (Butterfly1)
package {
import flash.display.*;
public dynamic class Butterfly1 extends MovieClip {
}
}//package
Section 13
//Butterfly2 (Butterfly2)
package {
import flash.display.*;
public dynamic class Butterfly2 extends MovieClip {
}
}//package
Section 14
//Butterfly3 (Butterfly3)
package {
import flash.display.*;
public dynamic class Butterfly3 extends MovieClip {
}
}//package
Section 15
//Clocky (Clocky)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Clocky extends MovieClip {
public var timeText:TextField;
}
}//package
Section 16
//Clouds1 (Clouds1)
package {
import flash.display.*;
public dynamic class Clouds1 extends MovieClip {
}
}//package
Section 17
//Copyright (Copyright)
package {
import flash.display.*;
public dynamic class Copyright extends MovieClip {
}
}//package
Section 18
//Fly (Fly)
package {
import flash.display.*;
public dynamic class Fly extends MovieClip {
}
}//package
Section 19
//FlySwat (FlySwat)
package {
import flash.display.*;
public dynamic class FlySwat extends MovieClip {
public var collisionBox:MovieClip;
}
}//package
Section 20
//GameOver (GameOver)
package {
import flash.display.*;
public dynamic class GameOver extends MovieClip {
public var backToMenu:SimpleButton;
public var submitScore:SimpleButton;
public var moreGames:SimpleButton;
public var playAgain:SimpleButton;
public function GameOver(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
}
}
}//package
Section 21
//Garden1 (Garden1)
package {
import flash.display.*;
public dynamic class Garden1 extends MovieClip {
}
}//package
Section 22
//Message (Message)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Message extends MovieClip {
public var messageText:TextField;
}
}//package
Section 23
//MissedUI (MissedUI)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MissedUI extends MovieClip {
public var scoreText:TextField;
}
}//package
Section 24
//Music1 (Music1)
package {
import flash.media.*;
public dynamic class Music1 extends Sound {
}
}//package
Section 25
//ScoreUI (ScoreUI)
package {
import flash.display.*;
import flash.text.*;
public dynamic class ScoreUI extends MovieClip {
public var scoreText:TextField;
}
}//package
Section 26
//SheepShadow (SheepShadow)
package {
import flash.display.*;
public dynamic class SheepShadow extends MovieClip {
}
}//package
Section 27
//Stapler (Stapler)
package {
import flash.media.*;
public dynamic class Stapler extends Sound {
}
}//package
Section 28
//SwatHit (SwatHit)
package {
import flash.media.*;
public dynamic class SwatHit extends Sound {
}
}//package
Section 29
//SwatMiss (SwatMiss)
package {
import flash.media.*;
public dynamic class SwatMiss extends Sound {
}
}//package
Section 30
//Window1 (Window1)
package {
import flash.display.*;
public dynamic class Window1 extends MovieClip {
}
}//package
Section 31
//WindowBorder (WindowBorder)
package {
import flash.display.*;
public dynamic class WindowBorder extends MovieClip {
}
}//package
Section 32
//WindowGlass (WindowGlass)
package {
import flash.display.*;
public dynamic class WindowGlass extends MovieClip {
}
}//package