Section 1
//fade_in_16 (CR_fla.fade_in_16)
package CR_fla {
import flash.display.*;
public dynamic class fade_in_16 extends MovieClip {
public function fade_in_16(){
addFrameScript(0, frame1, 500, frame501);
}
function frame501(){
stop();
}
function frame1(){
stop();
}
}
}//package CR_fla
Section 2
//Hud_Best_6 (CR_fla.Hud_Best_6)
package CR_fla {
import flash.display.*;
public dynamic class Hud_Best_6 extends MovieClip {
public function Hud_Best_6(){
addFrameScript(0, frame1, 74, frame75);
}
function frame75(){
stop();
}
function frame1(){
stop();
}
}
}//package CR_fla
Section 3
//HUD_Window_01_large_12 (CR_fla.HUD_Window_01_large_12)
package CR_fla {
import flash.display.*;
public dynamic class HUD_Window_01_large_12 extends MovieClip {
public var LetsGoButton:SimpleButton;
public var TPA:MovieClip;
public var introtext:MovieClip;
}
}//package CR_fla
Section 4
//HUD_Window_GameOver_22 (CR_fla.HUD_Window_GameOver_22)
package CR_fla {
import flash.display.*;
public dynamic class HUD_Window_GameOver_22 extends MovieClip {
public var TryAgainButton:SimpleButton;
public var GOAdd:MovieClip;
}
}//package CR_fla
Section 5
//HUD_Window_highscore_25 (CR_fla.HUD_Window_highscore_25)
package CR_fla {
import flash.display.*;
import flash.text.*;
public dynamic class HUD_Window_highscore_25 extends MovieClip {
public var highscore_name1:TextField;
public var highscore_name2:TextField;
public var highscore_name5:TextField;
public var highscore_name6:TextField;
public var highscore_name8:TextField;
public var highscore_name9:TextField;
public var highscore_name3:TextField;
public var highscore_name4:TextField;
public var highscore_name7:TextField;
public var BR:MovieClip;
public var highscore_number10:TextField;
public var PleaseWait:MovieClip;
public var highscore_score1:TextField;
public var highscore_score2:TextField;
public var highscore_score3:TextField;
public var highscore_score4:TextField;
public var highscore_score5:TextField;
public var highscore_score6:TextField;
public var highscore_score7:TextField;
public var highscore_score8:TextField;
public var highscore_score9:TextField;
public var highscore_name10:TextField;
public var highscore_number1:TextField;
public var highscore_number2:TextField;
public var highscore_number4:TextField;
public var highscore_number5:TextField;
public var highscore_number6:TextField;
public var highscore_number7:TextField;
public var highscore_number8:TextField;
public var highscore_number9:TextField;
public var highscore_number3:TextField;
public var FinalSubmit:SimpleButton;
public var highscore_score10:TextField;
public var CloseHighScore:SimpleButton;
public var InputName:TextField;
public var highscores_yourname:TextField;
public var BR2:MovieClip;
}
}//package CR_fla
Section 6
//HUD_Window_Pause_18 (CR_fla.HUD_Window_Pause_18)
package CR_fla {
import flash.display.*;
public dynamic class HUD_Window_Pause_18 extends MovieClip {
public var CB:MovieClip;
public var ResumeGameButton:SimpleButton;
}
}//package CR_fla
Section 7
//Introtext_15 (CR_fla.Introtext_15)
package CR_fla {
import flash.display.*;
public dynamic class Introtext_15 extends MovieClip {
public var fadein:MovieClip;
}
}//package CR_fla
Section 8
//NewRecord_7 (CR_fla.NewRecord_7)
package CR_fla {
import flash.display.*;
public dynamic class NewRecord_7 extends MovieClip {
public function NewRecord_7(){
addFrameScript(76, frame77);
}
function frame77(){
stop();
}
}
}//package CR_fla
Section 9
//PCAfrerTurn_41 (CR_fla.PCAfrerTurn_41)
package CR_fla {
import flash.display.*;
public dynamic class PCAfrerTurn_41 extends MovieClip {
public function PCAfrerTurn_41(){
addFrameScript(0, frame1);
}
function frame1(){
play();
}
}
}//package CR_fla
Section 10
//Symbol18_28 (CR_fla.Symbol18_28)
package CR_fla {
import flash.display.*;
public dynamic class Symbol18_28 extends MovieClip {
public function Symbol18_28(){
addFrameScript(162, frame163);
}
function frame163(){
stop();
}
}
}//package CR_fla
Section 11
//CR (KamikadzeRacer.CR)
package KamikadzeRacer {
import flash.display.*;
import flash.events.*;
import mochi.*;
import flash.text.*;
import flash.media.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public dynamic class CR extends MovieClip {
private var AccX:Number;// = 0
private var AccY:Number;// = 5
private var myFont:Font;
private var Distance:Number;// = 0
private var OtherCarSpawnY:Array;
private var swfLdr:Loader;
private var gameOverLdr:Loader;
private var CurrTime:uint;// = 0
private var speedArray:Array;
public var strips:Strips;
private var leftKeyIsUp:Boolean;// = false
private var engineChannel:SoundChannel;
private var SoundUnMuted:Boolean;// = true
private var PersonalBest:Number;// = 0
private var DisableEnterFrame:Boolean;// = false
private var VelX:Number;// = 0
private var VelY:Number;// = 50
private var fatalCrashChannel:SoundChannel;
private var rightKeyIsUp:Boolean;// = false
private var prevStatePlayerCar:String;// = " "
private var myFormat:TextFormat;
private var PlayerCollisionCar:Sprite;
private var PauseGame:Boolean;// = false
public var hud:Hud;
public var HUDHighScore:MovieClip;
private var stripCarType:Array;
private var keyRight:uint;// = 39
private var keyLeft:uint;// = 37
private var soundVolume:Number;// = 1
public var lines:MovieClip;
private var PlayerCar:MovieClip;
private var soundX:Sound;
private var OtherCarsInStrips:Array;
public var HUD_Begin:MovieClip;
public var TPB:SimpleButton;
private var ambientChannel:SoundChannel;
private var soundVol:SoundTransform;
private var ambientSound:Sound;
public var HUDPause:MovieClip;
private var distanceArray:Array;
private var rightKeyIsDown:Boolean;// = false
private var counter40:int;// = 0
private var SoundXChannel:SoundChannel;
private var playSoundX:Boolean;// = true
private var bridge:Sprite;
private var oncomingSound:Sound;
private var LoadedButtons:MovieClip;
private var statePlayerCar:String;// = "PC_Initial"
private var keySpaceIsDown:Boolean;// = false
private var toHighScore2Ldr:Loader;
private var PrevTime:uint;// = 0
private var fatalCrashSound:Sound;
private var toPauseLdr:Loader;
public var HUDGameOver:MovieClip;
private var leftKeyIsDown:Boolean;// = false
private var toHighScoreLdr:Loader;
private var keySpace:uint;// = 32
private var engineSound:Sound;
public function CR():void{
PauseGame = false;
leftKeyIsDown = false;
rightKeyIsDown = false;
keySpaceIsDown = false;
leftKeyIsUp = false;
rightKeyIsUp = false;
DisableEnterFrame = false;
playSoundX = true;
SoundUnMuted = true;
PrevTime = 0;
CurrTime = 0;
keyLeft = 37;
keyRight = 39;
keySpace = 32;
counter40 = 0;
VelX = 0;
VelY = 50;
AccX = 0;
AccY = 5;
PersonalBest = 0;
Distance = 0;
OtherCarsInStrips = new Array(12);
distanceArray = [3456, 2345, 1234, 100, 50, 200, 150, 300, 250, 300, 150, 100];
speedArray = [-200, -225, -250, 250, 225, 200, 175, 150, 125, 100, 75, 50];
OtherCarSpawnY = [-150, -150, -150, 500, 550, 570, 540, 580, 520, 510, 30, 30];
stripCarType = [0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 3, 3];
statePlayerCar = "PC_Initial";
prevStatePlayerCar = " ";
soundVol = new SoundTransform();
soundVolume = 1;
myFont = new CRArial();
myFormat = new TextFormat();
super();
Security.allowDomain("*");
MochiBot.track(this, "cbb589e5");
fixFonts();
hud.visible = false;
HUDPause.visible = false;
HUDGameOver.visible = false;
strips.visible = false;
lines.visible = false;
HUDHighScore.visible = false;
HUDHighScore.BR2.visible = false;
HUD_Begin.visible = false;
hud.SoundOnOff.visible = false;
hud.HUDSubmitPersonalBest.visible = false;
hud.ViewHighScoresButton.visible = true;
HUD_Begin.LetsGoButton.addEventListener(MouseEvent.CLICK, letsGoButtonClick);
hud.PauseGameButton.addEventListener(MouseEvent.CLICK, PauseButtonClick);
HUDPause.ResumeGameButton.addEventListener(MouseEvent.CLICK, PauseButtonClick);
HUDGameOver.TryAgainButton.addEventListener(MouseEvent.CLICK, letsGoButtonClick);
hud.HUDSubmitPersonalBest.addEventListener(MouseEvent.CLICK, submitPersonalBestButtonClick);
HUDHighScore.CloseHighScore.addEventListener(MouseEvent.CLICK, closeHighScoreButtonClick);
HUDHighScore.FinalSubmit.addEventListener(MouseEvent.CLICK, finalSubmitButtonClick);
TPB.addEventListener(MouseEvent.CLICK, TPBButtonClick);
hud.SoundOnOff.addEventListener(MouseEvent.CLICK, soundOnOffButtonClick);
hud.ViewHighScoresButton.addEventListener(MouseEvent.CLICK, VHSButtonClick);
fatalCrashSound = new FatalCrashBig();
fatalCrashChannel = new SoundChannel();
MochiAd.showPreGameAd({clip:root, id:"401b475ad4281d07", res:"360x400", ad_finished:adfinish});
}
private function toHighScore2LdrComplete(_arg1:Event):void{
var _local2:MovieClip;
_local2 = (toHighScore2Ldr.content as MovieClip);
HUDHighScore.BR2.addChild(_local2);
}
private function engineSoundCompleteHandler(_arg1:Event):void{
engineChannel.removeEventListener(Event.SOUND_COMPLETE, engineSoundCompleteHandler);
engineChannel = engineSound.play(30000);
engineChannel.addEventListener(Event.SOUND_COMPLETE, engineSoundCompleteHandler);
}
private function beginGame():void{
hud.ViewHighScoresButton.visible = false;
hud.HUDSubmitPersonalBest.visible = false;
hud.SoundOnOff.visible = true;
fatalCrashChannel.stop();
VelY = 50;
Distance = 0;
hud.visible = true;
strips.visible = true;
lines.visible = true;
HUD_Begin.visible = false;
HUDGameOver.visible = false;
DisableEnterFrame = false;
PlayerCar = new PlayerCarMC();
PlayerCar.y = 320;
PlayerCar.x = 236;
addChild(PlayerCar);
PlayerCollisionCar = new CollCarMC();
PlayerCollisionCar.x = PlayerCar.x;
PlayerCollisionCar.y = PlayerCar.y;
addChild(PlayerCollisionCar);
bridge = new BridgeMC();
bridge.x = 150;
bridge.y = -3000;
addChild(bridge);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, endGameKeyDown);
stage.addEventListener(KeyboardEvent.KEY_DOWN, stageKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, stageKeyUp);
hud.PauseGameButton.visible = true;
initOtherCars();
CurrTime = getTimer();
addEventListener(Event.ENTER_FRAME, CREnterFrame);
leftKeyIsDown = false;
rightKeyIsDown = false;
keySpaceIsDown = false;
leftKeyIsUp = true;
rightKeyIsUp = true;
counter40 = 0;
if (SoundUnMuted){
ambientSound = new ambient();
ambientChannel = new SoundChannel();
ambientChannel = ambientSound.play();
ambientChannel.addEventListener(Event.SOUND_COMPLETE, ambientSoundCompleteHandler);
engineSound = new engine();
engineChannel = new SoundChannel();
engineChannel = engineSound.play();
engineChannel.addEventListener(Event.SOUND_COMPLETE, engineSoundCompleteHandler);
};
oncomingSound = new nearmiss_oncoming();
soundX = new SoundX();
SoundXChannel = new SoundChannel();
hud.Hud_Best.gotoAndStop(1);
}
private function toHighScoreLdrComplete(_arg1:Event):void{
var _local2:MovieClip;
_local2 = (toHighScoreLdr.content as MovieClip);
HUDHighScore.BR.addChild(_local2);
}
private function toPauseLdrComplete(_arg1:Event):void{
var _local2:MovieClip;
_local2 = (toPauseLdr.content as MovieClip);
HUDPause.CB.addChild(_local2);
}
private function TPBButtonClick(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.tastyplay.com/");
navigateToURL(_local2, "_blank");
}
private function animateOtherCars(_arg1:Number):void{
var _local2:int;
var _local3:int;
_local2 = 0;
while (_local2 < OtherCarsInStrips.length) {
_local3 = 0;
while (_local3 < OtherCarsInStrips[_local2].length) {
OtherCarsInStrips[_local2][_local3].Update(VelY, _arg1);
if (PlayerCollisionCar.hitTestObject(OtherCarsInStrips[_local2][_local3].VisualOtherCar)){
endGame();
break;
};
_local3++;
};
_local2++;
};
}
private function adfinish():void{
var _local1:String;
var _local2:URLRequest;
MochiServices.connect("401b475ad4281d07", root);
MochiScores.setBoardID("c820156c6c4dc476");
HUD_Begin.visible = true;
HUD_Begin.introtext.fadein.play();
stage.addEventListener(KeyboardEvent.KEY_DOWN, endGameKeyDown);
swfLdr = new Loader();
_local1 = "http://www.tastyplay.com/play-more/kamikaze/more-kamikaze.swf";
_local2 = new URLRequest(_local1);
swfLdr.load(_local2);
swfLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLdrComplete);
toHighScoreLdr = new Loader();
toHighScoreLdr.load(_local2);
toHighScoreLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, toHighScoreLdrComplete);
toHighScore2Ldr = new Loader();
toHighScore2Ldr.load(_local2);
toHighScore2Ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, toHighScore2LdrComplete);
gameOverLdr = new Loader();
gameOverLdr.load(_local2);
gameOverLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, gameOverLdrComplete);
toPauseLdr = new Loader();
toPauseLdr.load(_local2);
toPauseLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, toPauseLdrComplete);
}
private function letsGoButtonClick(_arg1:MouseEvent):void{
beginGame();
}
private function animateStrips(_arg1:Number):void{
var _local2:Number;
if ((((VelY > 0)) && ((VelY < 200)))){
AccY = 50;
} else {
if ((((VelY >= 200)) && ((VelY < 300)))){
AccY = 2;
} else {
if (VelY > 350){
AccY = 0;
} else {
AccY = 0.5;
};
};
};
VelY = (VelY + (AccY * _arg1));
_local2 = (VelY * _arg1);
strips.y = (strips.y + _local2);
if (strips.y > 381){
strips.y = -3;
};
Distance = (Distance + _local2);
}
private function stageKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == keyLeft){
leftKeyIsDown = true;
leftKeyIsUp = false;
if (playSoundX){
if (SoundUnMuted){
SoundXChannel = soundX.play();
};
playSoundX = false;
};
} else {
if (_arg1.keyCode == keyRight){
rightKeyIsDown = true;
rightKeyIsUp = false;
if (playSoundX){
if (SoundUnMuted){
SoundXChannel = soundX.play();
};
playSoundX = false;
};
} else {
if (_arg1.keyCode == keySpace){
if (!keySpaceIsDown){
PauseGame = !(PauseGame);
keySpaceIsDown = true;
};
} else {
if (_arg1.keyCode == 83){
soundChange();
};
};
};
};
}
private function VHSButtonClick(_arg1:MouseEvent):void{
addEventListener(KeyboardEvent.KEY_DOWN, highscoreKeyDown);
MochiScores.requestList(this, OnLoadComplete);
HUDHighScore.visible = true;
HUDHighScore.BR2.visible = false;
this.setChildIndex(HUDHighScore, (this.numChildren - 1));
this.setChildIndex(TPB, (this.numChildren - 1));
stage.removeEventListener(KeyboardEvent.KEY_DOWN, endGameKeyDown);
HUDHighScore.PleaseWait.gotoAndPlay(1);
HUDHighScore.BR.visible = true;
}
private function fixFonts():void{
var _local1:int;
myFormat.font = myFont.fontName;
hud.SpeedText.defaultTextFormat = myFormat;
hud.SpeedText.embedFonts = true;
hud.SpeedText.antiAliasType = AntiAliasType.ADVANCED;
hud.SpeedText.selectable = false;
hud.DistanceText.defaultTextFormat = myFormat;
hud.DistanceText.embedFonts = true;
hud.DistanceText.antiAliasType = AntiAliasType.ADVANCED;
hud.DistanceText.selectable = false;
hud.BestText.defaultTextFormat = myFormat;
hud.BestText.embedFonts = true;
hud.BestText.antiAliasType = AntiAliasType.ADVANCED;
hud.BestText.selectable = false;
HUDHighScore.highscores_yourname.selectable = false;
_local1 = 1;
while (_local1 <= 10) {
(HUDHighScore.getChildByName(("highscore_name" + _local1.toString())) as TextField).defaultTextFormat = myFormat;
(HUDHighScore.getChildByName(("highscore_name" + _local1.toString())) as TextField).embedFonts = true;
(HUDHighScore.getChildByName(("highscore_name" + _local1.toString())) as TextField).antiAliasType = AntiAliasType.ADVANCED;
(HUDHighScore.getChildByName(("highscore_name" + _local1.toString())) as TextField).selectable = false;
(HUDHighScore.getChildByName(("highscore_score" + _local1.toString())) as TextField).defaultTextFormat = myFormat;
(HUDHighScore.getChildByName(("highscore_score" + _local1.toString())) as TextField).embedFonts = true;
(HUDHighScore.getChildByName(("highscore_score" + _local1.toString())) as TextField).antiAliasType = AntiAliasType.ADVANCED;
(HUDHighScore.getChildByName(("highscore_score" + _local1.toString())) as TextField).selectable = false;
(HUDHighScore.getChildByName(("highscore_number" + _local1.toString())) as TextField).selectable = false;
_local1++;
};
}
private function stageKeyUp(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == keyLeft){
leftKeyIsDown = false;
leftKeyIsUp = true;
if (SoundUnMuted){
SoundXChannel = soundX.play();
};
playSoundX = true;
} else {
if (_arg1.keyCode == keyRight){
rightKeyIsDown = false;
rightKeyIsUp = true;
if (SoundUnMuted){
SoundXChannel = soundX.play();
};
playSoundX = true;
} else {
if (_arg1.keyCode == keySpace){
if (keySpaceIsDown){
keySpaceIsDown = false;
};
};
};
};
}
private function closeHighScore():void{
HUDHighScore.visible = false;
removeEventListener(KeyboardEvent.KEY_DOWN, highscoreKeyDown);
stage.addEventListener(KeyboardEvent.KEY_DOWN, endGameKeyDown);
}
private function checkKeys(_arg1:Number):void{
if (PlayerCar.x < 15){
VelX = -(VelX);
PlayerCar.x = 15;
} else {
if (PlayerCar.x > 236){
VelX = -(VelX);
PlayerCar.x = 236;
} else {
if (leftKeyIsDown){
VelX = (-0.25 * VelY);
} else {
if (rightKeyIsDown){
VelX = (0.25 * VelY);
};
};
};
};
PlayerCar.x = (PlayerCar.x + (VelX * _arg1));
PlayerCollisionCar.x = PlayerCar.x;
PlayerCar.rotation = ((5 * VelX) * _arg1);
PlayerCollisionCar.rotation = PlayerCar.rotation;
if (leftKeyIsUp){
if (counter40 > 39){
statePlayerCar = "LeftAfrerTurn";
prevStatePlayerCar = "PC_Initial";
PlayerCar.stop();
counter40 = 0;
};
leftKeyIsUp = false;
VelX = 0;
} else {
if (rightKeyIsUp){
if (counter40 > 39){
statePlayerCar = "RightAfrerTurn";
prevStatePlayerCar = "PC_Initial";
PlayerCar.stop();
counter40 = 0;
};
rightKeyIsUp = false;
VelX = 0;
};
};
}
private function initOtherCars():void{
var _local1:int;
_local1 = 0;
while (_local1 < OtherCarsInStrips.length) {
OtherCarsInStrips[_local1] = null;
OtherCarsInStrips[_local1] = new Array();
OtherCarsInStrips[_local1].push(new OtherCar(this, _local1, OtherCarSpawnY[_local1], speedArray[_local1], (Math.round((Math.random() * stripCarType[_local1])) + 1)));
_local1++;
};
}
private function finalSubmit():void{
hud.HUDSubmitPersonalBest.visible = false;
HUDHighScore.BR2.visible = true;
HUDHighScore.highscores_yourname.text = "Score Submitted";
HUDHighScore.PleaseWait.gotoAndPlay(1);
(HUDHighScore.getChildByName("InputName") as TextField).selectable = false;
trace("finalSubmitButtonClick");
HUDHighScore.FinalSubmit.visible = false;
if (HUDHighScore.InputName.text.length <= 0){
HUDHighScore.InputName.text = "NoName";
};
MochiScores.submit(((Math.floor(PersonalBest) / 1000) * 1000), HUDHighScore.InputName.text);
MochiScores.requestList(this, OnLoadComplete);
}
private function placeStripOfCars(_arg1:int):void{
if ((VelY - speedArray[_arg1]) > 0){
if (OtherCarsInStrips[_arg1][0].VisualOtherCar.y > (100 + distanceArray[_arg1])){
OtherCarsInStrips[_arg1].unshift(new OtherCar(this, _arg1, -40, speedArray[_arg1], (Math.round((Math.random() * stripCarType[_arg1])) + 1)));
if ((((((_arg1 == 0)) || ((_arg1 == 1)))) || ((_arg1 == 2)))){
if (SoundUnMuted){
oncomingSound.play();
};
};
if (OtherCarsInStrips[_arg1].length > 25){
(OtherCarsInStrips[_arg1].pop() as OtherCar).Remove();
};
};
} else {
if (OtherCarsInStrips[_arg1][(OtherCarsInStrips[_arg1].length - 1)].VisualOtherCar.y < (-100 - distanceArray[_arg1])){
OtherCarsInStrips[_arg1].push(new OtherCar(this, _arg1, 440, speedArray[_arg1], (Math.round((Math.random() * stripCarType[_arg1])) + 1)));
if (OtherCarsInStrips[_arg1].length > 25){
(OtherCarsInStrips[_arg1].shift() as OtherCar).Remove();
};
};
};
}
private function highscoreKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 27){
closeHighScore();
};
if (_arg1.keyCode == 13){
finalSubmit();
};
}
private function submitPersonalBestButtonClick(_arg1:MouseEvent):void{
addEventListener(KeyboardEvent.KEY_DOWN, highscoreKeyDown);
(HUDHighScore.getChildByName("InputName") as TextField).selectable = true;
trace("submitPersonalBestButtonClick");
MochiScores.requestList(this, OnLoadComplete);
HUDHighScore.BR2.visible = false;
HUDHighScore.visible = true;
this.setChildIndex(HUDHighScore, (this.numChildren - 1));
this.setChildIndex(TPB, (this.numChildren - 1));
stage.removeEventListener(KeyboardEvent.KEY_DOWN, endGameKeyDown);
HUDHighScore.InputName.stage.focus = HUDHighScore.InputName;
HUDHighScore.InputName.setSelection(0, HUDHighScore.InputName.text.length);
HUDHighScore.highscores_yourname.text = "Type Your Name:";
HUDHighScore.PleaseWait.gotoAndPlay(1);
HUDHighScore.BR.visible = false;
}
private function closeHighScoreButtonClick(_arg1:MouseEvent):void{
closeHighScore();
}
private function endGame():void{
var c_row:int;
var c_col:int;
var intervalId:uint;
hud.ViewHighScoresButton.visible = true;
hud.HUDSubmitPersonalBest.visible = true;
hud.SoundOnOff.visible = false;
if (PersonalBest < Distance){
PersonalBest = Distance;
trace(PersonalBest);
hud.DistanceText.text = (Math.floor(Distance) / 1000).toString();
hud.BestText.text = (Math.floor(PersonalBest) / 1000).toString();
hud.Hud_Best.play();
hud.HUDSubmitPersonalBest.visible = true;
};
removeEventListener(Event.ENTER_FRAME, CREnterFrame);
DisableEnterFrame = true;
removeChild(PlayerCar);
removeChild(PlayerCollisionCar);
removeChild(bridge);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, stageKeyDown);
stage.removeEventListener(KeyboardEvent.KEY_UP, stageKeyUp);
stage.addEventListener(KeyboardEvent.KEY_DOWN, endGameKeyDown);
hud.PauseGameButton.visible = false;
HUDHighScore.FinalSubmit.visible = true;
HUDGameOver.visible = true;
c_row = 0;
while (c_row < OtherCarsInStrips.length) {
c_col = 0;
while (c_col < OtherCarsInStrips[c_row].length) {
OtherCarsInStrips[c_row][c_col].Remove();
c_col = (c_col + 1);
};
OtherCarsInStrips[c_row].length = 0;
c_row = (c_row + 1);
};
if (SoundUnMuted){
fatalCrashChannel = fatalCrashSound.play(0, 1);
};
engineChannel.stop();
if (Distance > 100000){
HUDGameOver.gotoAndPlay(1);
intervalId = setTimeout(function (){
HUDGameOver.gotoAndStop(Math.floor(((Math.random() * 10) + 1)));
}, 500);
} else {
if (Distance < 10000){
HUDGameOver.gotoAndPlay(1);
intervalId = setTimeout(function (){
HUDGameOver.gotoAndStop(Math.floor(((Math.random() * 10) + 1)));
}, 500);
} else {
HUDGameOver.gotoAndPlay(1);
intervalId = setTimeout(function (){
HUDGameOver.gotoAndStop(Math.floor(((Math.random() * 10) + 1)));
}, 500);
};
};
ambientChannel.removeEventListener(Event.SOUND_COMPLETE, ambientSoundCompleteHandler);
engineChannel.removeEventListener(Event.SOUND_COMPLETE, engineSoundCompleteHandler);
}
private function updateHud():void{
hud.SpeedText.text = Math.floor(VelY).toString();
hud.DistanceText.text = (Math.floor(Distance) / 1000).toString();
this.setChildIndex(hud, (this.numChildren - 1));
}
private function swfLdrComplete(_arg1:Event):void{
LoadedButtons = (swfLdr.content as MovieClip);
HUD_Begin.TPA.addChild(LoadedButtons);
}
private function soundOnOffButtonClick(_arg1:MouseEvent):void{
soundChange();
}
private function finalSubmitButtonClick(_arg1:MouseEvent):void{
finalSubmit();
}
private function endGameKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == keySpace){
beginGame();
};
}
private function animatePlayerCar(_arg1:Number):void{
if (counter40 > 39){
if ((((VelY >= 0)) && ((VelY <= 200)))){
statePlayerCar = "PC_Initial";
} else {
if ((((VelY > 200)) && ((VelY <= 275)))){
statePlayerCar = "shake00";
} else {
if ((((VelY > 275)) && ((VelY <= 352)))){
statePlayerCar = "shake01";
};
};
};
};
if (statePlayerCar != prevStatePlayerCar){
PlayerCar.gotoAndStop(statePlayerCar);
};
prevStatePlayerCar = statePlayerCar;
}
private function CREnterFrame(_arg1:Event):void{
var _local2:Number;
var _local3:int;
var _local4:uint;
if (PauseGame){
CurrTime = getTimer();
HUDPause.visible = true;
MochiAd.showClickAwayAd({clip:HUDPause, id:"401b475ad4281d07", width:250});
this.setChildIndex(HUDPause, (this.numChildren - 1));
this.setChildIndex(TPB, (this.numChildren - 1));
soundVol.volume = 0;
engineChannel.soundTransform = soundVol;
SoundXChannel.soundTransform = soundVol;
return;
};
counter40++;
HUDPause.visible = false;
soundVol.volume = 1;
engineChannel.soundTransform = soundVol;
PrevTime = CurrTime;
CurrTime = getTimer();
_local2 = ((CurrTime - PrevTime) / 1000);
animatePlayerCar(_local2);
animateStrips(_local2);
animateOtherCars(_local2);
if (!DisableEnterFrame){
animateBridge(_local2);
};
if (!DisableEnterFrame){
checkKeys(_local2);
};
_local3 = 0;
while (_local3 <= 11) {
if (!DisableEnterFrame){
placeStripOfCars(_local3);
};
_local3++;
};
_local4 = getTimer();
if (!DisableEnterFrame){
updateHud();
};
this.setChildIndex(TPB, (this.numChildren - 1));
}
private function ambientSoundCompleteHandler(_arg1:Event):void{
ambientChannel.removeEventListener(Event.SOUND_COMPLETE, ambientSoundCompleteHandler);
ambientChannel = ambientSound.play();
ambientChannel.addEventListener(Event.SOUND_COMPLETE, ambientSoundCompleteHandler);
}
private function soundChange():void{
SoundUnMuted = !(SoundUnMuted);
if (SoundUnMuted){
soundVol.volume = 1;
ambientSound = new ambient();
ambientChannel = new SoundChannel();
ambientChannel = ambientSound.play();
ambientChannel.addEventListener(Event.SOUND_COMPLETE, ambientSoundCompleteHandler);
engineSound = new engine();
engineChannel = new SoundChannel();
engineChannel = engineSound.play();
engineChannel.addEventListener(Event.SOUND_COMPLETE, engineSoundCompleteHandler);
} else {
ambientChannel.stop();
engineChannel.stop();
soundVol.volume = 0;
};
engineChannel.soundTransform = soundVol;
ambientChannel.soundTransform = soundVol;
fatalCrashChannel.soundTransform = soundVol;
SoundXChannel.soundTransform = soundVol;
}
private function gameOverLdrComplete(_arg1:Event):void{
var _local2:MovieClip;
_local2 = (gameOverLdr.content as MovieClip);
HUDGameOver.GOAdd.addChild(_local2);
}
private function PauseButtonClick(_arg1:MouseEvent):void{
PauseGame = !(PauseGame);
}
private function animateBridge(_arg1:Number):void{
this.setChildIndex(bridge, (this.numChildren - 1));
bridge.y = (bridge.y + (VelY * _arg1));
if (bridge.y > 1000){
bridge.y = -3000;
bridge.rotation = (Math.random() * 60);
};
}
private function OnLoadComplete(_arg1:Object):void{
var _local2:Object;
var _local3:int;
if (_arg1 != null){
_local2 = MochiScores.scoresArrayToObjects(_arg1.scores);
_local3 = 1;
while ((((_local3 < _local2.alltime.length)) && ((_local3 <= 10)))) {
(HUDHighScore.getChildByName(("highscore_name" + _local3.toString())) as TextField).text = _local2.alltime[(_local3 - 1)].name;
(HUDHighScore.getChildByName(("highscore_score" + _local3.toString())) as TextField).text = (_local2.alltime[(_local3 - 1)].score / 1000).toString();
trace(((_local2.alltime[(_local3 - 1)].name + " - ") + _local2.alltime[(_local3 - 1)].score));
if (HUDHighScore.InputName.text == (HUDHighScore.getChildByName(("highscore_name" + _local3.toString())) as TextField).text){
(HUDHighScore.getChildByName(("highscore_name" + _local3.toString())) as TextField).textColor = 0xFFFF00;
(HUDHighScore.getChildByName(("highscore_score" + _local3.toString())) as TextField).textColor = 0xFFFF00;
(HUDHighScore.getChildByName(("highscore_number" + _local3.toString())) as TextField).textColor = 0xFFFF00;
} else {
(HUDHighScore.getChildByName(("highscore_name" + _local3.toString())) as TextField).textColor = 0xCCCCCC;
(HUDHighScore.getChildByName(("highscore_score" + _local3.toString())) as TextField).textColor = 0xCCCCCC;
(HUDHighScore.getChildByName(("highscore_number" + _local3.toString())) as TextField).textColor = 0xCCCCCC;
};
_local3++;
};
} else {
trace("Results object is NULL");
};
}
}
}//package KamikadzeRacer
Section 12
//OtherCar (KamikadzeRacer.OtherCar)
package KamikadzeRacer {
import flash.display.*;
import flash.filters.*;
public class OtherCar {
private var stripArray:Array;
private var OtherCarSpeed:Number;
public var VisualOtherCar:Sprite;
private var Layer:Sprite;
private var Strip:int;
public function OtherCar(_arg1:Sprite, _arg2, _arg3:Number, _arg4, _arg5:int):void{
stripArray = [15, 36, 56, 77, 96, 116, 136, 156, 176, 196, 216, 236];
super();
Layer = _arg1;
OtherCarSpeed = _arg4;
Strip = _arg2;
if (_arg5 == 1){
VisualOtherCar = new OtherCarMC();
} else {
if (_arg5 == 2){
VisualOtherCar = new OtherTruckMC();
} else {
if (_arg5 == 3){
VisualOtherCar = new OtherSchoolBusMC();
} else {
if (_arg5 == 4){
VisualOtherCar = new OtherTruckLongMC();
} else {
VisualOtherCar = new OtherCarMC();
};
};
};
};
VisualOtherCar.x = stripArray[_arg2];
VisualOtherCar.y = _arg3;
_arg1.addChild(VisualOtherCar);
}
public function Update(_arg1:Number, _arg2:Number):void{
var _local3:BlurFilter;
VisualOtherCar.y = (VisualOtherCar.y + ((_arg1 * _arg2) - (OtherCarSpeed * _arg2)));
if ((((((Strip == 0)) || ((Strip == 1)))) || ((Strip == 2)))){
_local3 = new BlurFilter();
_local3.blurX = 0;
_local3.blurY = ((_arg1 - OtherCarSpeed) * 0.05);
_local3.quality = BitmapFilterQuality.MEDIUM;
VisualOtherCar.filters = [_local3];
};
}
public function Remove():void{
Layer.removeChild(VisualOtherCar);
}
}
}//package KamikadzeRacer
Section 13
//MochiDigits (mochi.MochiDigits)
package mochi {
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
Section 14
//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 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;
};
};
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
Section 15
//MochiServices (mochi.MochiServices)
package mochi {
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;
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 = "__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 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 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);
}
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 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("*");
Security.allowInsecureDomain("*");
};
};
return (_local2);
}
public static function getVersion():String{
return ("1.43");
}
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();
_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");
};
_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;
req.data = vars;
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
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 ((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 16
//ambient (ambient)
package {
import flash.media.*;
public dynamic class ambient extends Sound {
}
}//package
Section 17
//BridgeMC (BridgeMC)
package {
import flash.display.*;
public dynamic class BridgeMC extends MovieClip {
}
}//package
Section 18
//CollCarMC (CollCarMC)
package {
import flash.display.*;
public dynamic class CollCarMC extends MovieClip {
}
}//package
Section 19
//CRArial (CRArial)
package {
import flash.text.*;
public dynamic class CRArial extends Font {
}
}//package
Section 20
//engine (engine)
package {
import flash.media.*;
public dynamic class engine extends Sound {
}
}//package
Section 21
//FatalCrashBig (FatalCrashBig)
package {
import flash.media.*;
public dynamic class FatalCrashBig extends Sound {
}
}//package
Section 22
//Hud (Hud)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Hud extends MovieClip {
public var SpeedText:TextField;
public var ViewHighScoresButton:SimpleButton;
public var SoundOnOff:SimpleButton;
public var Hud_Best:MovieClip;
public var BestText:TextField;
public var PauseGameButton:SimpleButton;
public var HUDSubmitPersonalBest:SimpleButton;
public var DistanceText:TextField;
}
}//package
Section 23
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.7");
}
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?cacheBust=") + new Date().getTime()));
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 fn:Function;
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();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 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 24
//MochiBot (MochiBot)
package {
import flash.display.*;
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);
}
}
}//package
Section 25
//nearmiss_oncoming (nearmiss_oncoming)
package {
import flash.media.*;
public dynamic class nearmiss_oncoming extends Sound {
}
}//package
Section 26
//OtherCarMC (OtherCarMC)
package {
import flash.display.*;
public dynamic class OtherCarMC extends MovieClip {
}
}//package
Section 27
//OtherSchoolBusMC (OtherSchoolBusMC)
package {
import flash.display.*;
public dynamic class OtherSchoolBusMC extends MovieClip {
}
}//package
Section 28
//OtherTruckLongMC (OtherTruckLongMC)
package {
import flash.display.*;
public dynamic class OtherTruckLongMC extends MovieClip {
}
}//package
Section 29
//OtherTruckMC (OtherTruckMC)
package {
import flash.display.*;
public dynamic class OtherTruckMC extends MovieClip {
}
}//package
Section 30
//PlayerCarMC (PlayerCarMC)
package {
import flash.display.*;
public dynamic class PlayerCarMC extends MovieClip {
public var pcafterturn:MovieClip;
}
}//package
Section 31
//SoundX (SoundX)
package {
import flash.media.*;
public dynamic class SoundX extends Sound {
}
}//package
Section 32
//Strips (Strips)
package {
import flash.display.*;
public dynamic class Strips extends MovieClip {
}
}//package