Frame 2
function _shareScoreHandler(mc, scoreText) {
_root._alienShareScoreFB(scoreText);
}
function _homeShareScoreFB(scoreText) {
var _local1 = flash.external.ExternalInterface.available;
if (_local1) {
flash.external.ExternalInterface.call("g2wShareScore", scoreText);
} else {
getURL (("javascript:g2wShareScore('" + scoreText) + "')");
}
}
function _alienShareScoreFB() {
getURL (_root.obj_game.facebookURL, "_blank");
}
function _shareScoreFB(scoreText) {
var _local3 = new LocalConnection();
var _local2 = _root.fb_local_connection;
_local3.send(_local2, "callFBJS", "g2wShareScore", [scoreText]);
}
function _playAgainHandler(mc) {
Stage.scaleMode = "showAll";
_root.g2w_playagain(true);
}
function _showGameVideo() {
getURL ((("http://www.gangofgamers.com/videotutorial.html?url=" + _root.obj_game.videoID) + "&name=") + _root.obj_game._gameTitle, "_blank");
}
function _calculateScore(limits, score) {
var _local4 = false;
var _local1 = 0;
while (_local1 < (limits.length - 1)) {
if (score <= limits[_local1]) {
return(_local1);
}
_local1++;
}
return(limits.length - 1);
}
function _doGameOver(score, gamestate, showskip, delay) {
clearInterval(_gameoverinterval);
if (delay == undefined) {
delay = 3000;
}
if ((score != undefined) and (gamestate != undefined)) {
_root.partner_score = score;
_root.obj_game._gstatus = gamestate;
_gameoverinterval = setInterval(attachGameOverMc, delay, showskip);
}
}
function attachGameOverMc(showskip) {
stopAllSounds();
clearInterval(_gameoverinterval);
_root.__gameover_mc = _root.attachMovie("_g2w_gameover_mc", "mc_gameover", _root.getNextHighestDepth(), {_x:Stage.width / 2, _y:Stage.height / 2});
_root.__gameover_mc.showSkip = showskip;
}
function _showAssetPanels(mc) {
if (mc.gameState == "gameover") {
_root._initGameOver(mc);
} else {
_root._initGameCompleted(mc);
}
}
function g2w_playagain(resetlevel) {
_root.__gameover_mc.removeMovieClip();
if (resetlevel) {
_root.gotoAndStop("lblgame");
_root.game_mc.gotoAndStop("game_intro");
} else {
_root.gotoAndStop("lblgame");
_root.game_mc.gotoAndStop("game");
_root.game_mc.restartLevel();
}
}
function g2w_skiplevel() {
_root.__gameover_mc.removeMovieClip();
_root.score = 0;
_root.gameFeed_mc.gotoAndStop(1);
_root.nextLevel();
}
var obj_game = new Array();
obj_game._host = "gog";
obj_game._gameName = "vegas_traffic_mayhem";
obj_game._gameTitle = "Vegas Traffic Mayhem";
obj_game._g2wGameId = "10053";
obj_game._partnerGameId = "vegastrafficmayhem";
obj_game._gstatus = "gameover";
obj_game._googleText = "Vegas Traffic Mayhem";
obj_game._gameStageW = 650;
obj_game._gameStageH = 530;
obj_game._gameScoreOrder = "desc";
obj_game._gameResolution = (Stage.width + "x") + Stage.height;
obj_game.g2wBot = "";
obj_game.g2wBotId = 1344;
obj_game.videoID = "KBztgWGVQAI";
obj_game.facebookURL = "http://apps.facebook.com/gangofgamers-games/playpage.php?game=10053";
obj_game.FBShareurl = ("http://www.facebook.com/sharer.php?u=http://apps.facebook.com/gangofgamers-games/play/" + obj_game._g2wGameId) + "";
obj_game.inviziads = (((("http://s1.inviziads.com/lookup.html?g=" + obj_game._g2wGameId) + "&h=") + obj_game._host) + "&l=") + obj_game._gameLanguage;
obj_game.gameoverthumb = "http://www.gangofgamers.com/?utm_source=gog_wrapper&utm_medium=post_rolls&utm_content=vegas_traffic_mayhem&utm_campaign=gog_wrapper";
obj_game.gameoverstrip = "http://www.gangofgamers.com/?utm_source=gog_strip&utm_medium=post_rolls&utm_content=vegas_traffic_mayhem&utm_campaign=gog_strip";
obj_game.FBMsg = "is taming the traffic in sin city on Gangofgamers\u2019 Vegas Traffic Mayhem.Turn on the signal. Play the game.";
var obj_partner = new Array();
obj_partner.partner_name = "gog";
obj_partner.partner_id = 1;
obj_partner.invalid_txt = "Invalid Nickname!";
obj_partner.show_submit = false;
obj_partner.submitURL = "http://www.gangofgamers.com/submit_score.asp";
obj_partner.top10URL = "http://www.gangofgamers.com//get_top_scorer.asp";
obj_partner.lblsubmit = "Enter your GangofGamers Nickname below";
obj_partner.show_g2w_slate = true;
obj_partner.show_register = true;
obj_partner.text_register = "Create Nickname";
obj_partner.url_register = "http://www.gangofgamers.com//register.asp";
obj_partner.clickthru = "http://www.gangofgamers.com/";
obj_partner._allowclick = true;
_initAssetsPanel = function (mcpath) {
Stage.scaleMode = "noScale";
Stage.align = "";
var _local2 = mcpath;
_local2.onEnterFrame = function () {
Stage.scaleMode = "noScale";
Stage.align = "";
};
_local2.overlay_btn.useHandCursor = false;
_local2.gameState = _root.obj_game._gstatus;
};
_initGameOver = function (mcpath) {
var _local2 = mcpath;
if (!_root.checkhost()) {
_local2.gotoAndStop("g2w_spil_gameover");
} else {
_local2.gotoAndStop("g2w_gameover");
}
if (_local2.showSkip) {
_local2.g2w_skipPanel.gotoAndStop("skip");
_local2.g2w_skipPanel.btn_nextLevel.onRelease = function () {
Stage.scaleMode = "showAll";
_root.g2w_skiplevel();
};
}
_local2.g2w_skipPanel.btn_playAgain.onRelease = function () {
Stage.scaleMode = "showAll";
_root.g2w_playagain();
};
};
_initGameCompleted = function (mcpath) {
var _local2 = mcpath;
if (!_root.checkhost()) {
_local2.gotoAndStop("g2w_spil_gamecompleted");
} else {
_local2.gotoAndStop("g2w_gamecompleted");
}
};
var g2w_menu = new ContextMenu();
g2w_menu.hideBuiltInItems();
this.menu = g2w_menu;
checkhost = function () {
swfurl = this._url;
if ((swfurl.indexOf("games2win.com") == -1) && (swfurl.indexOf("gangofgamers.com") == -1)) {
return(false);
}
return(true);
};
_trackClickThru = function (mc) {
if (obj_partner._allowclick) {
mc.hit_area.onRelease = function () {
getURL (obj_partner.clickthru, "_blank");
};
} else {
mc.hit_area.useHandCursor = false;
}
};
String.prototype.trim = function () {
var _local3 = 0;
var _local2 = this.length;
white = new Object();
white._32 = 1;
_local2--;
while (white["_" + ord(this.charAt(_local2))]) {
}
while (white["_" + ord(this.charAt(_local3++))]) {
}
return(this.slice(_local3 - 1, _local2 + 1));
};
MovieClip.prototype._focusrect = false;
MovieClip.prototype.tabEnabled = false;
Button.prototype.tabEnabled = false;
Frame 10
stop();
Frame 19
stop();
Instance of Symbol 878 MovieClip in Frame 19
onClipEvent (load) {
total = _root.getBytesTotal();
}
onClipEvent (enterFrame) {
loaded = _root.getBytesLoaded();
percent = int((loaded / total) * 100);
load_txt.text = ("Loaded " + percent) + "%";
gotoAndStop(percent);
if (loaded == total) {
_parent.play();
}
}
Frame 26
stop();
Frame 34
function showScreen(_mc) {
_root.game_mc.gotoAndStop("game");
if (mc != undefined) {
mc.removeMovieClip();
mc = undefined;
}
if ((_mc != "popUp") && (_mc != "")) {
hidescoretxt();
}
if (_mc != "") {
mc = game_mc.attachMovie(_mc, _mc, 2500);
if (_mc == "winscreen") {
wait("complete");
}
if (_mc == "losescreen") {
wait("over");
}
if (_mc == "LevelSelector") {
mc.level1.enabled = true;
if (_root.game_mc.finishedLevels.indexOf("1") != -1) {
mc.level2.enabled = true;
} else {
mc.level2.enabled = false;
}
if (_root.game_mc.finishedLevels.indexOf("2") != -1) {
mc.level3.enabled = true;
} else {
mc.level3.enabled = false;
}
if (_root.game_mc.finishedLevels.indexOf("3") != -1) {
mc.level4.enabled = true;
} else {
mc.level4.enabled = false;
}
if (_root.game_mc.finishedLevels.indexOf("4") != -1) {
mc.level5.enabled = true;
} else {
mc.level5.enabled = false;
}
if (_root.game_mc.finishedLevels.indexOf("5") != -1) {
mc.level6.enabled = true;
} else {
mc.level6.enabled = false;
}
mc.l1mask._visible = false;
var _local2 = 0;
while (_local2 < game_mc.finishedLevels.length) {
mc["level" + (int(game_mc.finishedLevels.charAt(_local2)) + 1)].enabled = true;
mc[("l" + (int(game_mc.finishedLevels.charAt(_local2)) + 1)) + "mask"]._visible = false;
_local2++;
}
}
}
}
function hideScreen() {
if (mc != undefined) {
mc.removeMovieClip();
mc = undefined;
}
}
function showscoretxt() {
scoretxt._visible = true;
timermc._visible = true;
}
function hidescoretxt() {
scoretxt._visible = false;
timermc._visible = false;
}
function wait(str) {
interval = setInterval(this, "changeFrame", 2000, str);
}
function changeFrame(str) {
clearInterval(interval);
interval = null;
if (str == "over") {
_root.game_mc.gotoAndStop("game_over");
}
if (str == "complete") {
_root.game_mc.gotoAndStop("game_complete");
}
}
stop();
mc_fbshare.onRelease = function () {
getURL ("http://www.facebook.com/sharer.php?u=http://apps.facebook.com/gangofgamers-games/play/10053", "_blank");
};
stage.scaleMode = "noscale";
var mc = undefined;
var interval = null;
Symbol 943 MovieClip Frame 1
function brain() {
create_assets(myself, _global.obj_iads.type);
switch (_global.obj_iads.type) {
case "FULL" :
mcLoader.loadClip(_global.obj_iads.url, trgt_main);
break;
case "EMBED" :
mcLoader.loadClip(_global.obj_iads.url, trgt_main.trgt_ads);
if (_global.obj_iads.link ne undefined) {
trgt_main.onRelease = function () {
getURL (_global.obj_iads.link, "_blank");
};
}
break;
case "NOOP" :
clearInterval(tint1);
Stage.scaleMode = "showAll";
_root.play();
break;
}
}
function get_iads() {
lv_iads = new XML();
lv_result = new XML();
lv_result.ignoreWhite = true;
lv_result.onLoad = function (success) {
if (success) {
parse_iads(lv_result);
} else {
Stage.scaleMode = "showAll";
_root.play();
}
};
lv_iads.sendAndLoad(adurl, lv_result, "POST");
}
function parse_iads(lv_result) {
_global.obj_iads = new Array();
var _local2 = 0;
while (_local2 < lv_result.firstChild.childNodes.length) {
if (lv_result.firstChild.childNodes[_local2].firstChild.nodeValue != null) {
obj_iads[lv_result.firstChild.childNodes[_local2].nodeName] = lv_result.firstChild.childNodes[_local2].firstChild.nodeValue;
} else if (lv_result.firstChild.childNodes[_local2].firstChild.firstChild.nodeValue != null) {
var _local5 = new Object();
var _local4 = 0;
while (_local4 < lv_result.firstChild.childNodes[_local2].childNodes.length) {
_local5[lv_result.firstChild.childNodes[_local2].childNodes[_local4].nodeName] = lv_result.firstChild.childNodes[_local2].childNodes[_local4].firstChild.nodeValue;
_local4++;
}
obj_iads[lv_result.firstChild.childNodes[_local2].nodeName] = _local5;
}
_local2++;
}
show_time = int(_global.obj_iads.t);
check_type();
}
function time_delay() {
var _local1 = 0;
tint1 = setInterval(timespam, 1000);
}
function timespam() {
tim++;
trace(((tim + " tim Tim") + " show_time") + show_time);
if (isNaN(tim)) {
clearInterval(tint1);
Stage.scaleMode = "showAll";
trace(Stage.scaleMode);
} else if (tim == show_time) {
clearInterval(tint1);
Stage.scaleMode = "showAll";
_root.play();
trace(Stage.scaleMode);
}
}
function create_assets(mc, _type) {
mc.createEmptyMovieClip("whitebg", 0);
whitebg.beginFill(16777215);
whitebg.moveTo(0, 0);
whitebg.lineTo(0, 0);
whitebg.lineTo(stageWidth, 0);
whitebg.lineTo(stageWidth, stageHeight + 20);
whitebg.lineTo(0, stageHeight + 20);
whitebg.endFill();
mc.createEmptyMovieClip("trgt_main", 4);
mcLoader = new MovieClipLoader();
mcLoader.addListener(mc);
if (_type != "FULL") {
mc.createEmptyMovieClip("square_mc", 5);
var _local4 = trgt_main.createEmptyMovieClip("trgt_ads", getNextHighestDepth());
var _local3 = new TextFormat();
_local3.align = "center";
_local3.font = "Verdana";
_local3.size = 10;
var _local2 = new TextFormat();
_local2.align = "right";
_local2.font = "Verdana";
_local2.size = 10;
_local2.underline = true;
mc.createTextField("h_txt", mc.getNextHighestDepth(), 0, 0, 100, 22);
mc.createTextField("b_txt", mc.getNextHighestDepth(), 0, 0, 100, 22);
mc.createTextField("m_txt", mc.getNextHighestDepth(), 0, 0, 120, 22);
b_txt.autoSize = true;
m_txt.autoSize = true;
b_txt.selectable = false;
h_txt.selectable = false;
m_txt.selectable = false;
m_txt.html = true;
b_txt.multiline = true;
b_txt.setNewTextFormat(_local3);
h_txt.autoSize = true;
h_txt.setNewTextFormat(_local3);
m_txt.setNewTextFormat(_local2);
h_txt.text = "";
mc.createEmptyMovieClip("progressBar", 500);
}
}
function onLoadInit(mc) {
time_delay();
ad_width = int(_global.obj_iads.x);
ad_height = int(_global.obj_iads.y);
h_txt.text = "Advertisement";
loadMessages();
progressBar.tim = show_time;
progressBar.width = _global.obj_iads.x;
progressBar.height = 15;
progressBar._x = 100;
progressBar._y = 100;
bar_mc = progressBar.createEmptyMovieClip("bar", 1);
box_mc = progressBar.createEmptyMovieClip("box", 2);
bar_mc.beginFill(26112);
bar_mc.moveTo(0, 0);
bar_mc.lineTo(1, 0);
bar_mc.lineTo(1, progressBar.height - 2);
bar_mc.lineTo(0, progressBar.height - 2);
bar_mc.lineTo(0, 0);
bar_mc.endFill();
bar_mc._x = 1.5;
bar_mc._y = 1.5;
box_mc.lineStyle(1, 3355443, 100, true, "none", "round", "miter", 1);
box_mc.lineTo(progressBar.width, 0);
box_mc.lineTo(progressBar.width, progressBar.height);
box_mc.lineTo(0, progressBar.height);
box_mc.lineTo(0, 0);
box_mc._x = 0;
box_mc._y = 0;
progressBar.start = function () {
game_fps = getFps();
maxw = this.width - 2;
this.ad = maxw / (this.tim + 1);
this.ad = this.ad / game_fps;
};
progressBar.start();
progressBar.onEnterFrame = function () {
this.start();
if (this.bar._width < (this.width - 2)) {
this.bar._width = this.bar._width + this.ad;
} else {
this.bar._width = this.width;
}
};
b_txt.text = "Note\rClicking on the above Ad won't interrupt your game.\rAd link opens in a new window.";
myself._y = b_txt._y - 10;
x = (stageWidth / 2) - (ad_width / 2);
y = (stageHeight / 2) - (ad_height / 2);
mc._x = x;
mc._y = y;
h_txt._x = (x + (ad_width / 2)) - (h_txt._width / 2);
h_txt._y = y - 20;
progressBar._x = (x + (ad_width / 2)) - (progressBar._width / 2);
progressBar._y = (y + 5) + ad_height;
myself.invizi_logo._alpha = 100;
myself.invizi_logo.swapDepths(myself.getNextHighestDepth());
myself.invizi_logo._x = int(progressBar._x);
myself.invizi_logo._y = int(progressBar._y + progressBar._height) + 5;
m_txt._x = int(progressBar._x + progressBar._width) - m_txt._width;
m_txt._y = int(progressBar._y + progressBar._height) + 3;
myself.invizi_logo.onRelease = function () {
getURL ("http://www.inviziads.com/index.html?utm_source=4_1&utm_medium=logo&utm_content=default&utm_campaign=invizi", "_blank");
};
b_txt._x = (x + (ad_width / 2)) - (b_txt._width / 2);
b_txt._y = progressBar._y + 38;
square_mc.beginFill(16711680);
square_mc.moveTo(0, 0);
square_mc.lineTo(ad_width, 0);
square_mc.lineTo(ad_width, ad_height);
square_mc.lineTo(0, ad_height);
square_mc.lineTo(0, 0);
square_mc.endFill();
square_mc._x = x;
square_mc._y = y;
trgt_main.setMask(square_mc);
}
function loadMessages() {
lv_messages = new XML();
lv_messages.ignoreWhite = true;
lv_messages.onLoad = function (success) {
if (success) {
totalNodes = lv_messages.firstChild.childNodes.length;
ran = Math.floor(Math.random() * totalNodes);
if (lv_messages.firstChild.childNodes[ran].firstChild == undefined) {
m_txt.htmlText = "<font color='#0066CC'><a href='http://www.inviziads.com/adv-starter-pack.html' target='_blank'>Advertisers, try us out for US$250</a></font>";
} else {
m_txt.htmlText = ((("<font color='#0066CC'><a href='" + lv_messages.firstChild.childNodes[ran].attributes.link) + "' target='_blank'>") + lv_messages.firstChild.childNodes[ran].firstChild) + "</a></font>";
}
m_txt._x = int(progressBar._x + progressBar._width) - m_txt._width;
m_txt._y = int(progressBar._y + progressBar._height) + 2;
} else {
m_txt.htmlText = "<font color='#0066CC'><a href='http://inviziads.com' target='_blank'>Advertisers, try us out for US$250</a></font>";
m_txt._x = int(progressBar._x + progressBar._width) - m_txt._width;
m_txt._y = int(progressBar._y + progressBar._height) + 2;
}
};
lv_messages.load(messageURL);
}
function pushdata() {
holder.obj_iads = _global.obj_iads;
}
function startdatapush(mc) {
var _local2;
_local2 = setInterval(this, "pushdata", 10);
}
function check_type() {
if (_global.obj_iads.type eq "UPDATE") {
myself.createEmptyMovieClip("holder", 100);
var _local5 = _global.obj_iads.url;
obj_iads = _global.obj_iads;
var _local3 = new Object();
_local3.onLoadComplete = function (target_mc) {
};
var _local4 = new MovieClipLoader();
_local4.addListener(_local3);
_local4.loadClip(_global.obj_iads.url, holder);
} else {
brain();
}
clearInterval(this._parent._parent.int1);
}
function parse_xml(mydata) {
var _local4 = new Array();
var _local1 = 0;
while (_local1 < mydata.firstChild.childNodes.length) {
if (mydata.firstChild.childNodes[_local1].firstChild.nodeValue != null) {
_local4[mydata.firstChild.childNodes[_local1].nodeName] = mydata.firstChild.childNodes[_local1].firstChild.nodeValue;
} else if (mydata.firstChild.childNodes[_local1].firstChild.firstChild.nodeValue != null) {
var _local5 = new Object();
var _local2 = 0;
while (_local2 < lv_result.firstChild.childNodes[_local1].childNodes.length) {
_local4[lv_result.firstChild.childNodes[_local1].childNodes[_local2].nodeName] = mydata.firstChild.childNodes[_local1].childNodes[_local2].firstChild.nodeValue;
_local2++;
}
_local4[lv_result.firstChild.childNodes[_local1].nodeName] = _local5;
}
_local1++;
}
return(_local4);
}
function measureComScore() {
var _local1 = new LoadVars();
var _local2 = new LoadVars();
_local1.C1 = 7;
_local1.C2 = 5799339 /* 0x587DAB */;
_local1.C3 = 1;
var _local3 = "http://beacon.scorecardresearch.com/scripts/beacon.dll";
_local1.sendAndLoad(_local3, _local2, "GET");
_local2.onLoad = function (ok) {
if (ok) {
trace("Comscore Success");
} else {
trace("Comscore failed");
}
};
}
Stage.showMenu = false;
System.security.allowDomain("*");
System.security.allowInsecureDomain("*");
var time = 0;
var tim = 0;
var show_time = 0;
var tempo = 0;
var tint1;
var stageWidth = 0;
var stageHeight = 0;
getFps = function () {
if (signal == true) {
time = getTimer();
} else {
tempo = int(1000 / (getTimer() - time));
}
signal = !signal;
return(tempo);
};
this.onEnterFrame = function () {
game_fps = getFps();
if ((game_fps != 0) && (game_fps != undefined)) {
if (Stage.width > 0) {
stageWidth = Stage.width;
stageHeight = Stage.height;
get_iads();
this.onEnterFrame = null;
}
}
};
myself = this;
signal = true;
var purl = flash.external.ExternalInterface.call("document.URL.toString");
var hurl = escape(_root._url);
var adurl = "http://s1.inviziads.com/lookup.html?";
adurl = adurl + "g=10053";
adurl = adurl + "&h=gog";
adurl = adurl + "&type=pre";
adurl = adurl + "&v=5_0";
adurl = adurl + ("&purl=" + escape(purl));
adurl = adurl + ("&hurl=" + hurl);
adurl = adurl + "&l=en";
var my_date = new Date();
adurl = adurl + ("&ts=" + my_date.getSeconds());
var messageURL = "http://s1.inviziads.com/template/invizi_messages.xml";
stop();
Stage.scaleMode = "noScale";
Stage.align = "TL";
if ((purl.indexOf(".gangofgamers.com") == -1) && (hurl.indexOf(".gangofgamers.com") == -1)) {
measureComScore();
}
_root.stop();
Symbol 16 Button
on (release) {
getURL (_root.obj_game.gameoverstrip, "_blank");
}
Symbol 124 MovieClip Frame 1
stop();
Symbol 125 Button
on (release) {
getURL (_root.obj_game.gameoverthumb, "_blank");
}
Symbol 126 MovieClip Frame 1
stop();
var i = 1;
while (i <= 28) {
this["thumb" + i].gotoAndStop(i);
i++;
}
Symbol 135 MovieClip Frame 1
stop();
Symbol 135 MovieClip Frame 2
stop();
Symbol 157 MovieClip [_g2w_gameover_mc] Frame 1
_root._initAssetsPanel(this);
_root._showAssetPanels(this);
Symbol 157 MovieClip [_g2w_gameover_mc] Frame 2
stop();
btn_shareScore.onRelease = function () {
_root._shareScoreHandler(this, _root.obj_game.FBMsg);
};
btn_videoTutorial.onRelease = function () {
_root._showGameVideo();
};
mc_fbshare.onRelease = function () {
getURL (_root.obj_game.FBShareurl, "_blank");
};
Symbol 157 MovieClip [_g2w_gameover_mc] Frame 3
stop();
btn_shareScore.onRelease = function () {
_root._shareScoreHandler(this, _root.obj_game.FBMsg);
};
btn_videoTutorial.onRelease = function () {
_root._showGameVideo();
};
mc_fbshare.onRelease = function () {
getURL (_root.obj_game.FBShareurl, "_blank");
};
Symbol 157 MovieClip [_g2w_gameover_mc] Frame 4
stop();
btn_shareScore.onRelease = function () {
_root._shareScoreHandler(this, _root.obj_game.FBMsg);
};
btn_videoTutorial.onRelease = function () {
_root._showGameVideo();
};
btn_playAgain.onRelease = function () {
_root._playAgainHandler(this);
};
mc_fbshare.onRelease = function () {
getURL (_root.obj_game.FBShareurl, "_blank");
};
Symbol 157 MovieClip [_g2w_gameover_mc] Frame 5
stop();
btn_shareScore.onRelease = function () {
_root._shareScoreHandler(this, _root.obj_game.FBMsg);
};
btn_videoTutorial.onRelease = function () {
_root._showGameVideo();
};
btn_playAgain.onRelease = function () {
_root._playAgainHandler(this);
};
mc_fbshare.onRelease = function () {
getURL (_root.obj_game.FBShareurl, "_blank");
};
Symbol 168 MovieClip [Car2MC] Frame 1
stop();
Symbol 171 MovieClip [Car13MC] Frame 1
stop();
Symbol 176 MovieClip [Car12MC] Frame 1
stop();
Symbol 186 MovieClip [Car11MC] Frame 1
stop();
Symbol 192 MovieClip [Car10MC] Frame 1
stop();
Symbol 195 MovieClip [Car9MC] Frame 1
stop();
Symbol 198 MovieClip [Car8MC] Frame 1
stop();
Symbol 203 MovieClip [Car7MC] Frame 1
stop();
Symbol 206 MovieClip [Car6MC] Frame 1
stop();
Symbol 209 MovieClip [Car5MC] Frame 1
stop();
Symbol 214 MovieClip [Car4MC] Frame 1
stop();
Symbol 219 MovieClip [Car3MC] Frame 1
stop();
Symbol 222 MovieClip [Car1MC] Frame 1
stop();
Symbol 230 MovieClip [Level3Lights] Frame 1
#initclip 49
Object.registerClass("Level3Lights", Level3Lights);
#endinitclip
Symbol 293 MovieClip [Level3BG] Frame 1
#initclip 32
Object.registerClass("Level3BG", Level3BG);
#endinitclip
Symbol 306 MovieClip [Level4Lights] Frame 1
#initclip 33
Object.registerClass("Level4Lights", Level4Lights);
#endinitclip
Symbol 341 MovieClip [Level4BG] Frame 1
#initclip 34
Object.registerClass("Level4BG", Level4BG);
#endinitclip
Symbol 357 MovieClip [Level6Lights] Frame 1
#initclip 35
Object.registerClass("Level6Lights", Level6Lights);
#endinitclip
Symbol 390 MovieClip [Level6BG] Frame 1
#initclip 36
Object.registerClass("Level6BG", Level6BG);
#endinitclip
Symbol 396 MovieClip [Level5Lights] Frame 1
#initclip 37
Object.registerClass("Level5Lights", Level5Lights);
#endinitclip
Symbol 464 MovieClip [Level5BG] Frame 1
#initclip 38
Object.registerClass("Level5BG", Level5BG);
#endinitclip
Symbol 465 MovieClip [Level2Lights] Frame 1
#initclip 39
Object.registerClass("Level2Lights", Level2Lights);
#endinitclip
Symbol 502 MovieClip [Level2BG] Frame 1
#initclip 40
Object.registerClass("Level2BG", Level2BG);
#endinitclip
Symbol 517 MovieClip [Level1Lights] Frame 1
#initclip 41
Object.registerClass("Level1Lights", Level1Lights);
#endinitclip
Symbol 637 MovieClip [Level1BG] Frame 1
#initclip 42
Object.registerClass("Level1BG", Level1BG);
#endinitclip
Symbol 650 MovieClip [SignalMC] Frame 1
#initclip 43
Object.registerClass("SignalMC", SignalMC);
#endinitclip
stop();
Symbol 650 MovieClip [SignalMC] Frame 2
stop();
Symbol 651 MovieClip [Vehicle] Frame 1
#initclip 44
Object.registerClass("Vehicle", Vehicle);
#endinitclip
Symbol 652 MovieClip [Signal] Frame 1
#initclip 45
Object.registerClass("Signal", Signal);
#endinitclip
Symbol 654 MovieClip [IntersectionCollisionDetector] Frame 1
#initclip 46
Object.registerClass("IntersectionCollisionDetector", IntersectionCollisionDetector);
#endinitclip
Symbol 717 Button
on (press) {
if (_root.game_mc.finishedLevels.indexOf("5") != -1) {
_root.game_mc.clearLevel();
_root.game_mc.Level6();
}
}
Symbol 723 Button
on (press) {
_root.game_mc.clearLevel();
_root.game_mc.Level1();
}
Symbol 729 Button
on (press) {
if (_root.game_mc.finishedLevels.indexOf("1") != -1) {
_root.game_mc.clearLevel();
_root.game_mc.Level2();
}
}
Symbol 735 Button
on (press) {
if (_root.game_mc.finishedLevels.indexOf("2") != -1) {
_root.game_mc.clearLevel();
_root.game_mc.Level3();
}
}
Symbol 741 Button
on (press) {
if (_root.game_mc.finishedLevels.indexOf("4") != -1) {
_root.game_mc.clearLevel();
_root.game_mc.Level5();
}
}
Symbol 747 Button
on (press) {
if (_root.game_mc.finishedLevels.indexOf("3") != -1) {
_root.game_mc.clearLevel();
_root.game_mc.Level4();
}
}
Symbol 761 Button
on (press) {
_root.showScreen("LevelSelector");
}
Symbol 781 MovieClip Frame 6
stop();
Symbol 782 MovieClip Frame 7
stop();
Symbol 783 Button
on (press) {
_root.level1screenshot._visible = false;
_root.popup._visible = false;
_root.game_mc.actualLevel1();
}
Symbol 812 MovieClip [losescreen] Frame 1
stop();
Symbol 812 MovieClip [losescreen] Frame 2
stop();
Symbol 812 MovieClip [losescreen] Frame 3
stop();
Symbol 827 MovieClip [brain_inviziads] Frame 1
function brain() {
create_assets(myself, _global.obj_iads.type);
switch (_global.obj_iads.type) {
case "FULL" :
mcLoader.loadClip(_global.obj_iads.url, trgt_main);
break;
case "EMBED" :
mcLoader.loadClip(_global.obj_iads.url, trgt_main.trgt_ads);
if (_global.obj_iads.link ne undefined) {
trgt_main.onRelease = function () {
getURL (_global.obj_iads.link, "_blank");
};
}
break;
case "NOOP" :
clearInterval(int1);
_root.play();
break;
}
}
function get_iads() {
lv_iads = new XML();
lv_result = new XML();
lv_result.ignoreWhite = true;
lv_result.onLoad = function (success) {
if (success) {
parse_iads(lv_result);
} else {
_root.play();
}
};
lv_iads.g = game_id;
lv_iads.h = "as";
lv_iads.sendAndLoad(_root.adurl, lv_result, "POST");
}
function parse_iads(lv_result) {
_global.obj_iads = new Array();
var _local2 = 0;
while (_local2 < lv_result.firstChild.childNodes.length) {
if (lv_result.firstChild.childNodes[_local2].firstChild.nodeValue != null) {
obj_iads[lv_result.firstChild.childNodes[_local2].nodeName] = lv_result.firstChild.childNodes[_local2].firstChild.nodeValue;
} else if (lv_result.firstChild.childNodes[_local2].firstChild.firstChild.nodeValue != null) {
var _local5 = new Object();
var _local4 = 0;
while (_local4 < lv_result.firstChild.childNodes[_local2].childNodes.length) {
_local5[lv_result.firstChild.childNodes[_local2].childNodes[_local4].nodeName] = lv_result.firstChild.childNodes[_local2].childNodes[_local4].firstChild.nodeValue;
_local4++;
}
obj_iads[lv_result.firstChild.childNodes[_local2].nodeName] = _local5;
}
_local2++;
}
show_time = int(_global.obj_iads.t);
check_type();
}
function time_delay() {
tim = 0;
int1 = setInterval(timespam, 1000);
}
function timespam() {
tim++;
if (tim == show_time) {
clearInterval(int1);
_root.play();
}
}
function create_assets(mc, _type) {
mc.createEmptyMovieClip("whitebg", 0);
whitebg.beginFill(16777215);
whitebg.moveTo(0, 0);
whitebg.lineTo(0, 0);
whitebg.lineTo(Stage.width, 0);
whitebg.lineTo(Stage.width, Stage.height + 20);
whitebg.lineTo(0, Stage.height + 20);
whitebg.endFill();
mc.createEmptyMovieClip("trgt_main", 4);
mcLoader = new MovieClipLoader();
mcLoader.addListener(mc);
if (_type != "FULL") {
mc.createEmptyMovieClip("square_mc", 5);
var _local4 = trgt_main.createEmptyMovieClip("trgt_ads", getNextHighestDepth());
var _local3 = new TextFormat();
_local3.align = "center";
_local3.font = "Verdana";
_local3.size = 10;
var _local2 = new TextFormat();
_local2.align = "right";
_local2.font = "Verdana";
_local2.size = 10;
_local2.underline = true;
mc.createTextField("h_txt", mc.getNextHighestDepth(), 0, 0, 100, 22);
mc.createTextField("b_txt", mc.getNextHighestDepth(), 0, 0, 100, 22);
mc.createTextField("m_txt", mc.getNextHighestDepth(), 0, 0, 120, 22);
b_txt.autoSize = true;
m_txt.autoSize = true;
b_txt.selectable = false;
h_txt.selectable = false;
m_txt.selectable = false;
m_txt.html = true;
b_txt.multiline = true;
b_txt.setNewTextFormat(_local3);
h_txt.autoSize = true;
h_txt.setNewTextFormat(_local3);
m_txt.setNewTextFormat(_local2);
loadMessages();
h_txt.text = "";
mc.createEmptyMovieClip("progressBar", 500);
}
}
function onLoadInit(mc) {
ad_width = int(_global.obj_iads.x);
ad_height = int(_global.obj_iads.y);
h_txt.text = "Advertisement";
progressBar.tim = show_time;
progressBar.width = _global.obj_iads.x;
progressBar.height = 15;
progressBar.start = function () {
game_fps = getFps();
maxw = this.width - 2;
this.ad = maxw / (this.tim + 1);
this.ad = this.ad / game_fps;
};
progressBar.onEnterFrame = function () {
if (this.bar._width < (this.width - 2)) {
this.bar._width = this.bar._width + this.ad;
} else {
this.bar._width = this.width;
}
};
progressBar._x = 100;
progressBar._y = 100;
bar_mc = progressBar.createEmptyMovieClip("bar", 1);
box_mc = progressBar.createEmptyMovieClip("box", 2);
bar_mc.beginFill(26112);
bar_mc.moveTo(0, 0);
bar_mc.lineTo(1, 0);
bar_mc.lineTo(1, progressBar.height - 2);
bar_mc.lineTo(0, progressBar.height - 2);
bar_mc.lineTo(0, 0);
bar_mc.endFill();
bar_mc._x = 1.5;
bar_mc._y = 1.5;
box_mc.lineStyle(1, 3355443, 100, true, "none", "round", "miter", 1);
box_mc.lineTo(progressBar.width, 0);
box_mc.lineTo(progressBar.width, progressBar.height);
box_mc.lineTo(0, progressBar.height);
box_mc.lineTo(0, 0);
box_mc._x = 0;
box_mc._y = 0;
progressBar.start();
b_txt.text = "Note\rClicking on the above Ad won't interrupt your game.\rAd link opens in a new window.\rThanks to our sponsors, we provide you free games to play.";
myself._y = b_txt._y - 10;
x = (Stage.width / 2) - (ad_width / 2);
y = (Stage.height / 2) - (ad_height / 2);
mc._x = x;
mc._y = y;
h_txt._x = (x + (ad_width / 2)) - (h_txt._width / 2);
h_txt._y = y - 20;
progressBar._x = (x + (ad_width / 2)) - (progressBar._width / 2);
progressBar._y = (y + 5) + ad_height;
myself.attachMovie("invizi_logo", "invizi_logo", this.getNextHighestDepth() + 100);
myself.invizi_logo.swapDepths(myself.getNextHighestDepth());
myself.invizi_logo._x = int(progressBar._x);
myself.invizi_logo._y = int(progressBar._y + progressBar._height) + 5;
m_txt._x = int(progressBar._x + progressBar._width) - m_txt._width;
m_txt._y = int(progressBar._y + progressBar._height) + 3;
myself.invizi_logo.onRelease = function () {
getURL ("http://www.inviziads.com", "_blank");
};
b_txt._x = (x + (ad_width / 2)) - (b_txt._width / 2);
b_txt._y = progressBar._y + 38;
square_mc.beginFill(16711680);
square_mc.moveTo(0, 0);
square_mc.lineTo(ad_width, 0);
square_mc.lineTo(ad_width, ad_height);
square_mc.lineTo(0, ad_height);
square_mc.lineTo(0, 0);
square_mc.endFill();
square_mc._x = x;
square_mc._y = y;
trgt_main.setMask(square_mc);
}
function loadMessages() {
lv_messages = new XML();
lv_messages.onLoad = function (success) {
if (success) {
totalNodes = lv_messages.firstChild.childNodes.length;
ran = Math.floor(Math.random() * totalNodes);
if (lv_messages.firstChild.childNodes[ran].firstChild == undefined) {
m_txt.htmlText = "<font color='#ff0000'><a href='http://www.inviziads.com/adv-starter-pack.html' target='_blank'>Advertisers, try us out for US$250</a></font>";
} else {
m_txt.htmlText = ((("<font color='#ff0000'><a href='" + lv_messages.firstChild.childNodes[ran].attributes.link) + "' target='_blank'>") + lv_messages.firstChild.childNodes[ran].firstChild) + "</a></font>";
}
m_txt._x = int(progressBar._x + progressBar._width) - m_txt._width;
m_txt._y = int(progressBar._y + progressBar._height) + 2;
} else {
m_txt.htmlText = "<font color='#ff0000'><a href='http://www.inviziads.com/adv-starter-pack.html' target='_blank'>Advertisers, try us out for US$250</a></font>";
m_txt._x = int(progressBar._x + progressBar._width) - m_txt._width;
m_txt._y = int(progressBar._y + progressBar._height) + 2;
}
};
lv_messages.load(_root.messageURL);
}
function pushdata() {
holder.obj_iads = _global.obj_iads;
}
function startdatapush(mc) {
var _local2;
_local2 = setInterval(this, "pushdata", 10);
}
function check_type() {
if (_global.obj_iads.type eq "UPDATE") {
myself.createEmptyMovieClip("holder", 100);
var _local4 = _global.obj_iads.url;
show_time = 15;
obj_iads = _global.obj_iads;
var _local2 = new Object();
_local2.onLoadComplete = function (target_mc) {
};
var _local3 = new MovieClipLoader();
_local3.addListener(_local2);
_local3.loadClip(_global.obj_iads.url, holder);
} else {
brain();
}
time_delay();
}
function parse_xml(mydata) {
var _local4 = new Array();
var _local1 = 0;
while (_local1 < mydata.firstChild.childNodes.length) {
if (mydata.firstChild.childNodes[_local1].firstChild.nodeValue != null) {
_local4[mydata.firstChild.childNodes[_local1].nodeName] = mydata.firstChild.childNodes[_local1].firstChild.nodeValue;
} else if (mydata.firstChild.childNodes[_local1].firstChild.firstChild.nodeValue != null) {
var _local5 = new Object();
var _local2 = 0;
while (_local2 < lv_result.firstChild.childNodes[_local1].childNodes.length) {
_local4[lv_result.firstChild.childNodes[_local1].childNodes[_local2].nodeName] = mydata.firstChild.childNodes[_local1].childNodes[_local2].firstChild.nodeValue;
_local2++;
}
_local4[lv_result.firstChild.childNodes[_local1].nodeName] = _local5;
}
_local1++;
}
return(_local4);
}
System.security.allowDomain("*");
getFps = function () {
if (signal == true) {
time = getTimer();
} else {
tempo = int(1000 / (getTimer() - time));
}
signal = !signal;
return(tempo);
};
this.onEnterFrame = function () {
game_fps = getFps();
if ((game_fps != 0) && (game_fps != undefined)) {
this.onEnterFrame = null;
}
};
myself = this;
signal = true;
if (_root.checkhost() == false) {
_root.stop();
var my_date = new Date();
_root.adurl = (_root.obj_game.inviziads + "&type=pre&ts=") + my_date.getSeconds();
_root.messageURL = "http://s1.inviziads.com/template/invizi_messages.xml";
get_iads();
} else {
_root.play();
}
Symbol 829 MovieClip [MuteButton] Frame 1
#initclip 47
Object.registerClass("MuteButton", MuteButton);
#endinitclip
Symbol 835 MovieClip [game_mc] Frame 1
#initclip 48
Object.registerClass("game_mc", Game);
#endinitclip
stop();
loadStartScreen();
Symbol 835 MovieClip [game_mc] Frame 34
stop();
instruct_btn.onPress = function () {
this._parent.gotoAndStop("game");
};
Symbol 835 MovieClip [game_mc] Frame 58
stop();
over_btn.onPress = function () {
this._parent.gotoAndStop("game_over");
};
win_btn.onPress = function () {
this._parent.gotoAndStop("game_complete");
};
Symbol 835 MovieClip [game_mc] Frame 106
stop();
_root._doGameOver(0, "gameover", false, 1500);
Symbol 835 MovieClip [game_mc] Frame 120
stop();
_root._doGameOver(0, "gamecompleted", false, 1500);
Symbol 839 MovieClip [game_sound_ctrl] Frame 1
stop();
this.onRelease = function () {
SoundFX.toggleMuteMusic();
this.gotoAndStop("off");
};
Symbol 839 MovieClip [game_sound_ctrl] Frame 2
stop();
this.onRelease = function () {
SoundFX.toggleMuteMusic();
this.gotoAndStop("on");
};
Symbol 842 MovieClip Frame 1
_root._trackClickThru(this);
Symbol 910 MovieClip [__Packages.SoundFX] Frame 0
class SoundFX
{
static var muteMusic, muteFX, bgMusicName, bgSound;
function SoundFX () {
muteMusic = false;
muteFX = false;
bgMusicName = "";
bgSound = new Sound();
}
static function initialize() {
muteMusic = false;
muteFX = false;
bgMusicName = "";
bgSound = new Sound();
}
static function stopBackground() {
bgMusicName = "";
stopBackgroundImmediate();
}
static function stopBackgroundImmediate() {
bgSound.stop();
}
static function playBackground() {
if (!muteMusic) {
bgSound.attachSound(bgMusicName);
bgSound.setVolume(100);
bgSound.start(0, 1000);
}
}
static function playMenuBackground() {
stopBackgroundImmediate();
bgMusicName = "MenuBG01";
playBackground();
}
static function playSadBackground() {
stopBackgroundImmediate();
bgMusicName = "SadBG01";
playBackground();
}
static function playGameBackground(musicNo) {
stopBackgroundImmediate();
bgMusicName = "gameBG0" + musicNo;
playBackground();
}
static function toggleMuteMusic() {
muteMusic = (muteMusic ? false : true);
muteFX = (muteFX ? false : true);
if (!muteMusic) {
playBackground();
} else {
stopBackgroundImmediate();
}
}
}
Symbol 911 MovieClip [__Packages.Level3BG] Frame 0
class Level3BG extends MovieClip
{
function Level3BG () {
super();
}
}
Symbol 912 MovieClip [__Packages.Level4Lights] Frame 0
class Level4Lights extends MovieClip
{
function Level4Lights () {
super();
}
}
Symbol 913 MovieClip [__Packages.Level4BG] Frame 0
class Level4BG extends MovieClip
{
function Level4BG () {
super();
}
}
Symbol 914 MovieClip [__Packages.Level6Lights] Frame 0
class Level6Lights extends MovieClip
{
function Level6Lights () {
super();
}
}
Symbol 915 MovieClip [__Packages.Level6BG] Frame 0
class Level6BG extends MovieClip
{
function Level6BG () {
super();
}
}
Symbol 916 MovieClip [__Packages.Level5Lights] Frame 0
class Level5Lights extends MovieClip
{
function Level5Lights () {
super();
}
}
Symbol 917 MovieClip [__Packages.Level5BG] Frame 0
class Level5BG extends MovieClip
{
function Level5BG () {
super();
}
}
Symbol 918 MovieClip [__Packages.Level2Lights] Frame 0
class Level2Lights extends MovieClip
{
function Level2Lights () {
super();
}
}
Symbol 919 MovieClip [__Packages.Level2BG] Frame 0
class Level2BG extends MovieClip
{
function Level2BG () {
super();
}
}
Symbol 920 MovieClip [__Packages.Level1Lights] Frame 0
class Level1Lights extends MovieClip
{
function Level1Lights () {
super();
}
}
Symbol 921 MovieClip [__Packages.Level1BG] Frame 0
class Level1BG extends MovieClip
{
function Level1BG () {
super();
}
}
Symbol 922 MovieClip [__Packages.SignalMC] Frame 0
class SignalMC extends MovieClip
{
function SignalMC () {
super();
}
}
Symbol 923 MovieClip [__Packages.Vehicle] Frame 0
class Vehicle extends MovieClip
{
var interRow, added_for_collision, delegateSetSignalState, delegateOnAdded, delegateOnRemoved, delegateOnOneVehicleStop, delegateOnOneVehicleStarted, attachMovie, getNextHighestDepth, original, _rotation, interval, _height, _y, _width, _x, hitTest, vehicleInFront, onEnterFrame, handler, brake;
function Vehicle () {
super();
_road = 0;
gameOverSent = false;
interRow = undefined;
crossSignalEventSender = null;
dispatchEvent = false;
added_for_collision = false;
delegateSetSignalState = mx.utils.Delegate.create(this, setSignalState);
delegateOnAdded = mx.utils.Delegate.create(this, onAdded);
delegateOnRemoved = mx.utils.Delegate.create(this, onRemoved);
delegateOnOneVehicleStop = mx.utils.Delegate.create(this, onOneVehicleStop);
delegateOnOneVehicleStarted = mx.utils.Delegate.create(this, onOneVehicleStarted);
CustomEventDispatcher.addEventListener(CustomEvents.SIGNAL_CHANGED, delegateSetSignalState);
CustomEventDispatcher.addEventListener(CustomEvents.VEHICLE_STOPED, delegateOnOneVehicleStop);
CustomEventDispatcher.addEventListener(CustomEvents.VEHICLE_STARTED, delegateOnOneVehicleStarted);
CustomEventDispatcher.addEventListener(CustomEvents.ADDED, delegateOnAdded);
CustomEventDispatcher.addEventListener(CustomEvents.REMOVED, delegateOnRemoved);
}
function setArt(ch) {
var _local2 = randomizeFrame(ch);
art = attachMovie(("Car" + _local2) + "MC", (("Car" + _local2) + "MC") + id, getNextHighestDepth());
}
function onAdded(ce) {
if (ce.data.object == this) {
added_for_collision = true;
interRow = ce.data.info;
}
}
function onRemoved(ce) {
if ((ce.data.object == this) && (interRow == ce.data.info)) {
added_for_collision = false;
}
}
function get signal() {
return(_signal);
}
function set signal(value) {
_signal = value;
//return(signal);
}
function get _crossSignalEventSender() {
return(crossSignalEventSender);
}
function set _crossSignalEventSender(value) {
crossSignalEventSender = value;
//return(_crossSignalEventSender);
}
function get intersections() {
return(_intersections);
}
function set intersections(value) {
_intersections = value;
//return(intersections);
}
function get road() {
return(_road);
}
function set road(value) {
_road = value;
//return(road);
}
function get id() {
return(_id);
}
function set id(value) {
_id = value;
art.info.text = _id;
//return(id);
}
function get signalId() {
return(_signalId);
}
function set signalId(value) {
_signalId = value;
//return(signalId);
}
function get lane() {
return(_lane);
}
function set lane(value) {
_lane = value;
//return(lane);
}
function get speed() {
return(_speed);
}
function set speed(value) {
_speed = value;
DISTANCE_FROM_SIGNAL_FOR_STOPPING = Math.abs(GameConstants.LEVEL_CAR_DISTANCE * 2);
//return(speed);
}
function get status() {
return(_status);
}
function set status(value) {
_status = value;
//return(status);
}
function get limitLine() {
return(_limitLine);
}
function set limitLine(value) {
_limitLine = value;
//return(limitLine);
}
function sendGameOverSignal() {
var _local2 = new Object();
_local2.reason = "trafficjam";
_local2.object = this;
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.GAME_OVER, _local2));
gameOverSent = true;
}
function move(test, _or) {
original = _or;
if (_rotation == 0) {
if ((_limitLine != undefined) && (_limitLine >= Game.stageHeight)) {
sendGameOverSignal();
}
} else if (_rotation == 180) {
if ((_limitLine != undefined) && (_limitLine <= 0)) {
sendGameOverSignal();
}
} else if (_rotation == 90) {
if ((_limitLine != undefined) && (_limitLine <= 0)) {
sendGameOverSignal();
}
} else if (_rotation == -90) {
if ((_limitLine != undefined) && (_limitLine >= Game.stageWidth)) {
sendGameOverSignal();
}
}
if (!gameOverSent) {
interval = test;
addHandler();
}
return(undefined);
}
function checkJam() {
if (_rotation == 0) {
if (Math.floor((_y + _height) + DISTANCE_FROM_SIGNAL_FOR_STOPPING) >= Game.stageHeight) {
sendGameOverSignal();
}
} else if (_rotation == 180) {
if (Math.floor((_y - _height) - DISTANCE_FROM_SIGNAL_FOR_STOPPING) <= 0) {
sendGameOverSignal();
}
} else if (_rotation == 90) {
if (Math.floor((_x - _width) - DISTANCE_FROM_SIGNAL_FOR_STOPPING) <= 0) {
sendGameOverSignal();
}
} else if (_rotation == -90) {
if (Math.floor((_x + _width) + DISTANCE_FROM_SIGNAL_FOR_STOPPING) >= Game.stageWidth) {
sendGameOverSignal();
}
}
}
function moveVehicleOnEnterFrame1() {
var _local3 = 0;
while (_local3 < _intersections.length) {
if (hitTest(_intersections[_local3])) {
if (!added_for_collision) {
_intersections[_local3].addItem(this);
}
break;
}
if (added_for_collision && (_intersections[_local3] == interRow)) {
_intersections[_local3].removeItem(this);
break;
}
_local3++;
}
if (vehicleInFront && (Math.abs(Math.floor(vehicleInFront._y - _y)) < Math.floor(vehicleInFront._height + vehicleInFront.DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
var _local2 = vehicleInFront;
while (((_local2.vehicleInFront && (Math.abs(Math.floor(_local2.vehicleInFront._y - _local2._y)) < Math.floor(_local2.vehicleInFront._height + _local2.vehicleInFront.DISTANCE_FROM_SIGNAL_FOR_STOPPING))) && (_local2)) && (_local2.limitLine)) {
_local2 = _local2.vehicleInFront;
}
if ((_local2._y >= _local2.original) && (_local2._y <= (_local2.original + _local2.DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
checkJam();
}
return(undefined);
}
if (dispatchEvent) {
var _local4 = new Object();
_local4.object = this;
_local4.lane = _lane;
}
status = (true);
if (!_signal) {
if ((((_limitLine != undefined) && (_y >= _limitLine)) && (_y <= (_limitLine + DISTANCE_FROM_SIGNAL_FOR_STOPPING))) && (crossSignalEventSender)) {
removeHandler();
status = (false);
signalStop();
return(undefined);
}
_y = _y + speed;
if (dispatchEvent) {
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.VEHICLE_STARTED, _local4));
dispatchEvent = false;
}
} else {
if (((_limitLine != undefined) && (_y >= _limitLine)) && (_y <= (_limitLine + DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
removeHandler();
status = (false);
signalStop();
return(undefined);
}
_y = _y + speed;
if (dispatchEvent) {
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.VEHICLE_STARTED, _local4));
dispatchEvent = false;
}
}
if (_y < 0) {
sendReachedExtremeSignal();
return(undefined);
}
if (_limitLine && (_y < _limitLine)) {
sendChangeSignalEvent();
return(undefined);
}
updateAfterEvent();
}
function moveVehicleOnEnterFrame2() {
var _local3 = 0;
while (_local3 < _intersections.length) {
if (hitTest(_intersections[_local3])) {
if (!added_for_collision) {
_intersections[_local3].addItem(this);
}
break;
}
if (added_for_collision && (_intersections[_local3] == interRow)) {
_intersections[_local3].removeItem(this);
break;
}
_local3++;
}
if (vehicleInFront && (Math.abs(Math.floor(vehicleInFront._y - _y)) < Math.floor(vehicleInFront._height + vehicleInFront.DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
var _local2 = vehicleInFront;
while (((_local2.vehicleInFront && (Math.abs(Math.floor(_local2.vehicleInFront._y - _local2._y)) < Math.floor(_local2.vehicleInFront._height + _local2.vehicleInFront.DISTANCE_FROM_SIGNAL_FOR_STOPPING))) && (_local2)) && (_local2.limitLine)) {
_local2 = _local2.vehicleInFront;
}
if ((_local2._y <= _local2.original) && (_local2._y >= (_local2.original - _local2.DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
checkJam();
}
return(undefined);
}
if (dispatchEvent) {
var _local4 = new Object();
_local4.object = this;
_local4.lane = _lane;
}
status = (true);
if (!_signal) {
if ((((_limitLine != undefined) && (_y <= _limitLine)) && (_y >= (_limitLine - DISTANCE_FROM_SIGNAL_FOR_STOPPING))) && (crossSignalEventSender)) {
removeHandler();
status = (false);
signalStop();
return(undefined);
}
_y = _y + speed;
if (dispatchEvent) {
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.VEHICLE_STARTED, _local4));
dispatchEvent = false;
}
} else if (_rotation == 0) {
if (((_limitLine != undefined) && (_y >= _limitLine)) && (_y <= (_limitLine + DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
removeHandler();
status = (false);
signalStop();
return(undefined);
}
_y = _y + speed;
if (dispatchEvent) {
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.VEHICLE_STARTED, _local4));
dispatchEvent = false;
}
} else {
if (((_limitLine != undefined) && (_y <= _limitLine)) && (_y >= (_limitLine - DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
removeHandler();
status = (false);
signalStop();
return(undefined);
}
_y = _y + speed;
if (dispatchEvent) {
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.VEHICLE_STARTED, _local4));
dispatchEvent = false;
}
}
if (_y > Game.stageHeight) {
sendReachedExtremeSignal();
return(undefined);
}
if (_limitLine && (_y > _limitLine)) {
sendChangeSignalEvent();
return(undefined);
}
updateAfterEvent();
}
function moveVehicleOnEnterFrame3() {
var _local3 = 0;
while (_local3 < _intersections.length) {
if (hitTest(_intersections[_local3])) {
if (!added_for_collision) {
_intersections[_local3].addItem(this);
}
break;
}
if (added_for_collision && (_intersections[_local3] == interRow)) {
_intersections[_local3].removeItem(this);
break;
}
_local3++;
}
if (vehicleInFront && (Math.abs(Math.floor(vehicleInFront._x - _x)) < Math.floor(vehicleInFront._width + DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
var _local2 = vehicleInFront;
while (((_local2.vehicleInFront && (Math.abs(Math.floor(_local2.vehicleInFront._x - _local2._x)) < Math.floor(_local2.vehicleInFront._width + _local2.vehicleInFront.DISTANCE_FROM_SIGNAL_FOR_STOPPING))) && (_local2)) && (_local2.limitLine)) {
_local2 = _local2.vehicleInFront;
}
if ((_local2._x <= _local2.original) && (_local2._x >= (_local2.original - _local2.DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
checkJam();
}
return(undefined);
}
if (dispatchEvent) {
var _local4 = new Object();
_local4.object = this;
_local4.lane = _lane;
}
status = (true);
if (!_signal) {
if ((((_limitLine != undefined) && (_x <= _limitLine)) && (_x >= (_limitLine - DISTANCE_FROM_SIGNAL_FOR_STOPPING))) && (crossSignalEventSender)) {
removeHandler();
status = (false);
signalStop();
return(undefined);
}
_x = _x + speed;
if (dispatchEvent) {
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.VEHICLE_STARTED, _local4));
dispatchEvent = false;
}
} else {
if (((_limitLine != undefined) && (_x <= _limitLine)) && (_x >= (_limitLine - DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
removeHandler();
status = (false);
signalStop();
return(undefined);
}
_x = _x + speed;
if (dispatchEvent) {
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.VEHICLE_STARTED, _local4));
dispatchEvent = false;
}
}
if (_limitLine && (_x > _limitLine)) {
sendChangeSignalEvent();
return(undefined);
}
if (_x > Game.stageWidth) {
sendReachedExtremeSignal();
return(undefined);
}
updateAfterEvent();
}
function moveVehicleOnEnterFrame4() {
var _local3 = 0;
while (_local3 < _intersections.length) {
if (hitTest(_intersections[_local3])) {
if (!added_for_collision) {
_intersections[_local3].addItem(this);
}
break;
}
if (added_for_collision && (_intersections[_local3] == interRow)) {
_intersections[_local3].removeItem(this);
break;
}
_local3++;
}
if (vehicleInFront && (Math.abs(Math.floor(vehicleInFront._x - _x)) < Math.floor(vehicleInFront._width + DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
var _local2 = vehicleInFront;
while (((_local2.vehicleInFront && (Math.abs(Math.floor(_local2.vehicleInFront._x - _local2._x)) < Math.floor(_local2.vehicleInFront._width + _local2.vehicleInFront.DISTANCE_FROM_SIGNAL_FOR_STOPPING))) && (_local2)) && (_local2.limitLine)) {
_local2 = _local2.vehicleInFront;
}
if ((_local2._x >= _local2.original) && (_local2._x <= (_local2.original + _local2.DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
checkJam();
}
return(undefined);
}
if (dispatchEvent) {
var _local4 = new Object();
_local4.object = this;
_local4.lane = _lane;
}
status = (true);
if (!_signal) {
if ((((_limitLine != undefined) && (_x >= _limitLine)) && (_x <= (_limitLine + DISTANCE_FROM_SIGNAL_FOR_STOPPING))) && (crossSignalEventSender)) {
removeHandler();
status = (false);
signalStop();
return(undefined);
}
_x = _x + speed;
if (dispatchEvent) {
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.VEHICLE_STARTED, _local4));
dispatchEvent = false;
}
} else {
if (((_limitLine != undefined) && (_x >= _limitLine)) && (_x <= (_limitLine + DISTANCE_FROM_SIGNAL_FOR_STOPPING))) {
removeHandler();
status = (false);
signalStop();
return(undefined);
}
_x = _x + speed;
if (dispatchEvent) {
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.VEHICLE_STARTED, _local4));
dispatchEvent = false;
}
}
if (_limitLine && (_x < _limitLine)) {
sendChangeSignalEvent();
return(undefined);
}
if (_x < 0) {
sendReachedExtremeSignal();
return(undefined);
}
updateAfterEvent();
}
function sendChangeSignalEvent() {
if (signalId >= 0) {
var _local2 = new Object();
_local2.object = this;
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.PLEASE_CHANGE_MY_SIGNAL, _local2));
}
}
function onOneVehicleStarted(ce) {
if (crossSignalEventSender && (crossSignalEventSender == ce.data.object)) {
crossSignalEventSender = null;
if (!onEnterFrame) {
var _local2 = new Object();
addHandler();
_local2.object = this;
_local2.lane = _lane;
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.VEHICLE_STARTED, _local2));
}
}
}
function onOneVehicleStop(ce) {
if ((((((ce.data.road == _road) && (ce.data.lane == _lane)) && (status)) && (_signal)) && (ce.data.id == _signalId)) && (ce.data.object != this)) {
_limitLine = ce.data.newLimit;
} else if ((((ce.data.road == _road) && (ce.data.lane == _lane)) && (status)) && (ce.data.id != _signalId)) {
if ((_rotation == 0) || (_rotation == -90)) {
if ((ce.data.newLimit > _limitLine) && (ce.data.id > _signalId)) {
_limitLine = ce.data.newLimit;
crossSignalEventSender = Vehicle(ce.data.object);
}
} else if ((_rotation == 90) || (_rotation == 180)) {
if ((ce.data.newLimit < _limitLine) && (ce.data.id > _signalId)) {
_limitLine = ce.data.newLimit;
crossSignalEventSender = Vehicle(ce.data.object);
}
}
}
}
function sendReachedExtremeSignal() {
var _local2 = new Object();
_local2.object = this;
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.CAR_REACHED_EXTREME, _local2));
}
function stopMe() {
removeHandler();
CustomEventDispatcher.removeEventListener(CustomEvents.SIGNAL_CHANGED, delegateSetSignalState);
CustomEventDispatcher.removeEventListener(CustomEvents.VEHICLE_STOPED, delegateOnOneVehicleStop);
CustomEventDispatcher.removeEventListener(CustomEvents.VEHICLE_STARTED, delegateOnOneVehicleStarted);
CustomEventDispatcher.removeEventListener(CustomEvents.ADDED, delegateOnAdded);
CustomEventDispatcher.removeEventListener(CustomEvents.REMOVED, delegateOnRemoved);
}
function removeHandler() {
handler = false;
delete onEnterFrame;
}
function addHandler() {
if (_rotation == 0) {
onEnterFrame = moveVehicleOnEnterFrame1;
} else if (_rotation == 180) {
onEnterFrame = moveVehicleOnEnterFrame2;
} else if (_rotation == 90) {
onEnterFrame = moveVehicleOnEnterFrame3;
} else if (_rotation == -90) {
onEnterFrame = moveVehicleOnEnterFrame4;
}
handler = true;
}
function signalStop() {
var _local2 = new Object();
if (_rotation == 0) {
_local2.newLimit = Math.floor((_limitLine + _height) + DISTANCE_FROM_SIGNAL_FOR_STOPPING);
} else if (_rotation == 90) {
_local2.newLimit = Math.floor((_limitLine - _width) - DISTANCE_FROM_SIGNAL_FOR_STOPPING);
} else if (_rotation == 180) {
_local2.newLimit = Math.floor((_limitLine - _height) - DISTANCE_FROM_SIGNAL_FOR_STOPPING);
} else if (_rotation == -90) {
_local2.newLimit = Math.floor((_limitLine + _width) + DISTANCE_FROM_SIGNAL_FOR_STOPPING);
}
_local2.object = this;
_local2.road = _road;
_local2.lane = _lane;
_local2.id = _signalId;
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.VEHICLE_STOPED, _local2));
if ((_rotation == 0) || (_rotation == 180)) {
brake = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Regular.easeOut, _y, _limitLine, 0.5, true);
} else if ((_rotation == 90) || (_rotation == -90)) {
brake = new mx.transitions.Tween(this, "_x", mx.transitions.easing.Regular.easeOut, _x, _limitLine, 0.5, true);
}
return(undefined);
}
function setSignalState(ce) {
if ((_signalId != undefined) && (ce.data.id == _signalId)) {
_signal = ce.data.state;
}
if (_signal == false) {
if (!handler) {
brake.stop();
addHandler();
dispatchEvent = true;
}
}
}
function randomizeFrame(ch) {
var _local2 = 13;
var _local1 = Math.random();
if (ch) {
_local1 = Math.floor((_local1 * (_local2 - 4)) * 10) % (_local2 - 4);
} else {
_local1 = Math.floor((_local1 * _local2) * 10) % _local2;
}
return(_local1);
}
var _speed = undefined;
var _status = undefined;
var _limitLine = undefined;
var _signal = undefined;
var _signalId = undefined;
var _lane = undefined;
var art = undefined;
var _road = undefined;
var DISTANCE_FROM_SIGNAL_FOR_STOPPING = undefined;
var gameOverSent = undefined;
var _id = 0;
var crossSignalEventSender = undefined;
var _intersections = undefined;
var dispatchEvent = false;
}
Symbol 924 MovieClip [__Packages.IntersectionCollisionDetector] Frame 0
class IntersectionCollisionDetector extends MovieClip
{
static var vehicles;
var times, accidentSound, onEnterFrame, car1, car2, dir1, dir2, xspeed1, yspeed1, xspeed2, yspeed2, _xscale, _width, _yscale, _height, _alpha;
function IntersectionCollisionDetector () {
super();
times = 0;
vehicles = new Array();
accidentSound = new Sound();
accidentSound.attachSound("AccidentSound");
}
function checkForCollision() {
var _local5 = false;
var _local7 = getTimer();
if (vehicles.length > 1) {
var _local3 = 0;
while (_local3 < vehicles.length) {
var _local2 = _local3 + 1;
while (_local2 < vehicles.length) {
if (vehicles[_local3]._rotation != vehicles[_local2]._rotation) {
if (vehicles[_local3].art.collider.hitTest(vehicles[_local2].art.collider)) {
if (!SoundFX.muteMusic) {
SoundFX.stopBackgroundImmediate();
accidentSound.start(0, 1);
}
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.COLLISION));
_local5 = true;
delete onEnterFrame;
car1 = vehicles[_local3];
car2 = vehicles[_local2];
if ((car1._rotation == 90) || (car1._rotation == -90)) {
var _local4 = car1;
car1 = car2;
car2 = _local4;
}
prepareForReaction();
onEnterFrame = collisionReaction;
break;
}
}
_local2++;
}
if (_local5) {
break;
}
_local3++;
}
}
var _local6 = getTimer();
}
function prepareForReaction() {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
if (car1.getDepth() < car2.getDepth()) {
car1.swapDepths(car2);
}
} else if (car2.getDepth() < car1.getDepth()) {
car2.swapDepths(car1);
}
if (car1._rotation == 0) {
if (car2._rotation == 90) {
if (car2._y < car1._y) {
if ((car1._x >= ((car2._x - car2._width) - car1._width)) && (car1._x <= (car2._x + car1._width))) {
if ((car1._x + (car1._width / 2)) < (car2._x - (car2._width / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 0;
dir2 = 10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = -10;
dir2 = 5;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = -5;
dir2 = 10;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
}
} else if ((car1._x + (car1._width / 2)) >= (car2._x - (car2._width / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 0;
dir2 = 10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = 10;
dir2 = -5;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = 5;
dir2 = -10;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
}
}
} else if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 5;
dir2 = -10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = 10;
dir2 = -5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = 10;
dir2 = -5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
} else if ((car2._y + (car2._height / 2)) < (car1._y + (car1._height / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 5;
dir2 = -10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = 10;
dir2 = -5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = 10;
dir2 = -5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
} else if ((car2._y + (car2._height / 2)) >= (car1._y + (car1._height / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = -5;
dir2 = 10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = -10;
dir2 = 5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = 10;
dir2 = -10;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
}
} else if (car2._rotation == -90) {
if ((car2._y - car2._height) < car1._y) {
if ((car1._x >= (car2._x - car1._width)) && (car1._x <= ((car2._x + car2._width) + car1._width))) {
if ((car1._x + (car1._width / 2)) < (car2._x + (car2._width / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 0;
dir2 = 10;
xspeed1 = 0;
yspeed1 = 0;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = -10;
dir2 = 5;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = -5;
dir2 = 10;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
}
} else if ((car1._x + (car1._width / 2)) >= (car2._x + (car2._width / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 0;
dir2 = 10;
xspeed1 = 0;
yspeed1 = 0;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = 10;
dir2 = -5;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = 5;
dir2 = -10;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
}
}
} else if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = -5;
dir2 = 10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = -10;
dir2 = 5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = 5;
dir2 = -10;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
} else if ((car2._y - (car2._height / 2)) < (car1._y + (car1._height / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = -5;
dir2 = 10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = -10;
dir2 = 5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = 5;
dir2 = -10;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
} else if ((car2._y - (car2._height / 2)) >= (car1._y + (car1._height / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 5;
dir2 = -10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = 10;
dir2 = -5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = 10;
dir2 = -10;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
}
}
} else if (car1._rotation == 180) {
if (car2._rotation == 90) {
if (car2._y > car1._y) {
if ((car1._x >= ((car2._x - car2._width) - car1._width)) && (car1._x <= (car2._x + car1._width))) {
if ((car1._x + (car1._width / 2)) < (car2._x - (car2._width / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 0;
dir2 = -10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = 10;
dir2 = -5;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = 5;
dir2 = -10;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
}
} else if ((car1._x + (car1._width / 2)) >= (car2._x - (car2._width / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 0;
dir2 = -10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = -10;
dir2 = 5;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = -5;
dir2 = 10;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
}
}
} else if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = -5;
dir2 = 10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = -10;
dir2 = 5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = -10;
dir2 = 5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
} else if ((car2._y + (car2._height / 2)) < (car1._y - (car1._height / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = -5;
dir2 = 10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = -10;
dir2 = 5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = -10;
dir2 = 5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
} else if ((car2._y + (car2._height / 2)) >= (car1._y - (car1._height / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 5;
dir2 = -10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = 10;
dir2 = -5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = -10;
dir2 = 10;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
}
} else if (car2._rotation == -90) {
if ((car2._y - car2._height) > car1._y) {
if ((car1._x >= (car2._x - car1._width)) && (car1._x <= ((car2._x + car2._width) + car1._width))) {
if ((car1._x + (car1._width / 2)) < (car2._x + (car2._width / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 0;
dir2 = -10;
xspeed1 = 0;
yspeed1 = 0;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = 10;
dir2 = -5;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = 0;
yspeed2 = car2.speed;
} else {
dir1 = 5;
dir2 = -10;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
}
} else if ((car1._x + (car1._width / 2)) >= (car2._x + (car2._width / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 0;
dir2 = -10;
xspeed1 = 0;
yspeed1 = 0;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = -10;
dir2 = 5;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = 0;
yspeed2 = car2.speed;
} else {
dir1 = -5;
dir2 = 10;
xspeed1 = 0;
yspeed1 = (-car1.__get__speed()) / 2;
xspeed2 = car2.speed;
yspeed2 = car1.speed;
}
}
} else if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 5;
dir2 = -10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = 10;
dir2 = -5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = 5;
dir2 = 10;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
} else if ((car2._y - (car2._height / 2)) < (car1._y - (car1._height / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = 5;
dir2 = -10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = 10;
dir2 = -5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = -5;
dir2 = 10;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
} else if ((car2._y - (car2._height / 2)) >= (car1._y - (car1._height / 2))) {
if ((car1._width * car1._height) > (car2._width * car2._height)) {
dir1 = -5;
dir2 = 10;
xspeed1 = 0;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
} else if ((car1._width * car1._height) < (car2._width * car2._height)) {
dir1 = -10;
dir2 = 5;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = car2.speed;
yspeed2 = 0;
} else {
dir1 = -10;
dir2 = 10;
xspeed1 = car2.speed;
yspeed1 = car1.speed;
xspeed2 = (-car2.__get__speed()) / 2;
yspeed2 = 0;
}
}
}
}
}
function collisionReaction() {
if (((times == 10) || ((((xspeed1 == 0) && (xspeed2 == 0)) && (yspeed1 == 0)) && (yspeed2 == 0))) || ((dir1 == 0) && (dir2 == 0))) {
delete onEnterFrame;
} else {
dir1 = dir1 - (dir1 * 0.25);
dir2 = dir2 - (dir2 * 0.25);
xspeed1 = xspeed1 - (xspeed1 * 0.5);
yspeed1 = yspeed1 - (yspeed1 * 0.5);
xspeed2 = xspeed2 - (xspeed2 * 0.5);
yspeed2 = yspeed2 - (yspeed2 * 0.5);
times++;
car1._rotation = car1._rotation + dir1;
car2._rotation = car2._rotation + dir2;
car1._x = car1._x + xspeed1;
car1._y = car1._y + yspeed1;
car2._x = car2._x + xspeed2;
car2._y = car2._y + yspeed2;
}
}
function initialize(width, height) {
_xscale = (width / _width) * 100;
_yscale = (height / _height) * 100;
_alpha = 0;
}
function addItem(vehicle) {
var _local4 = true;
var _local3 = 0;
while (_local3 < vehicles.length) {
if (vehicles[_local3] == vehicle) {
_local4 = false;
break;
}
_local3++;
}
if (_local4) {
vehicles.push(vehicle);
_root.inter.text = vehicles.length;
if (vehicles.length > 1) {
onEnterFrame = checkForCollision;
}
var _local6 = new Object();
_local6.object = vehicle;
_local6.info = this;
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.ADDED, _local6));
}
}
function removeItem(vehicle) {
var _local4 = -1;
var _local3 = 0;
while (_local3 < vehicles.length) {
if (vehicles[_local3] == vehicle) {
_local4 = _local3;
break;
}
_local3++;
}
if (_local4 != -1) {
vehicles.splice(_local4, 1);
_root.inter.text = vehicles.length;
if (vehicles.length < 2) {
delete onEnterFrame;
}
var _local6 = new Object();
_local6.object = vehicle;
_local6.info = this;
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.REMOVED, _local6));
}
}
}
Symbol 925 MovieClip [__Packages.CustomEventDispatcher] Frame 0
class CustomEventDispatcher
{
static var disp;
function CustomEventDispatcher () {
}
static function addEventListener(p_type, p_listener) {
if (disp == null) {
disp = new Sender();
mx.events.EventDispatcher.initialize(disp);
}
disp.addEventListener(p_type, p_listener);
}
static function removeEventListener(p_type, p_listener) {
if (disp == null) {
return(undefined);
}
disp.removeEventListener(p_type, p_listener);
}
static function dispatchEvent(p_event) {
if (disp == null) {
return(undefined);
}
disp.sendEvent(p_event);
}
}
Symbol 926 MovieClip [__Packages.Sender] Frame 0
class Sender
{
var dispatchEvent;
function Sender () {
mx.events.EventDispatcher.initialize(this);
}
function sendEvent(object) {
dispatchEvent({target:object, type:object.event, data:object.data});
}
}
Symbol 927 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
if (queue != undefined) {
var _local4 = queue.length;
var _local1;
_local1 = 0;
while (_local1 < _local4) {
var _local2 = queue[_local1];
if (_local2 == handler) {
queue.splice(_local1, 1);
return(undefined);
}
_local1++;
}
}
}
static function initialize(object) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
object.addEventListener = _fEventDispatcher.addEventListener;
object.removeEventListener = _fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var _local7 = "__q_" + eventObj.type;
var _local4 = queueObj[_local7];
if (_local4 != undefined) {
var _local5;
for (_local5 in _local4) {
var _local1 = _local4[_local5];
var _local3 = typeof(_local1);
if ((_local3 == "object") || (_local3 == "movieclip")) {
if (_local1.handleEvent != undefined) {
_local1.handleEvent(eventObj);
}
if (_local1[eventObj.type] != undefined) {
if (exceptions[eventObj.type] == undefined) {
_local1[eventObj.type](eventObj);
}
}
} else {
_local1.apply(queueObj, [eventObj]);
}
}
}
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(this, eventObj);
}
function addEventListener(event, handler) {
var _local3 = "__q_" + event;
if (this[_local3] == undefined) {
this[_local3] = new Array();
}
_global.ASSetPropFlags(this, _local3, 1);
_removeEventListener(this[_local3], event, handler);
this[_local3].push(handler);
}
function removeEventListener(event, handler) {
var _local2 = "__q_" + event;
_removeEventListener(this[_local2], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1, load:1};
}
Symbol 928 MovieClip [__Packages.CustomEvents] Frame 0
class CustomEvents
{
var event, data;
function CustomEvents (event, _data) {
this.event = event;
if (_data) {
data = _data;
}
}
static var SIGNAL_CHANGED = "signalchanged";
static var VEHICLE_STOPED = "vehiclestoped";
static var VEHICLE_STARTED = "vehiclestarted";
static var GAME_OVER = "gameover";
static var CAR_REACHED_EXTREME = "carreachedextreme";
static var PLEASE_CHANGE_MY_SIGNAL = "pleasechangemysignal";
static var COLLISION = "collision";
static var ADDED = "added";
static var REMOVED = "removed";
}
Symbol 929 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 930 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 931 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var version = "1.1.0.52";
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 932 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 933 MovieClip [__Packages.GameConstants] Frame 0
class GameConstants
{
function GameConstants () {
}
static var UP = 0;
static var RIGHT = 1;
static var DOWN = 2;
static var LEFT = 3;
static var SPAWN_DISTANCE = 10;
static var LEVEL_CAR_DISTANCE = 5;
static var SIGNAL_DEPTH = 1000;
static var BG_DEPTH = 100;
static var CAR_DEPTH = 150;
static var LIGHT_DEPTH = 850;
static var winMsg = [["Sweet!", "Smooth sailing there."], ["Whoosh!", "You\u2019re getting better."], ["Awesome!", " It seems under control."], ["Neat!", "Smooth running traffic."], ["Splendid!", "You\u2019ve mastered it!"], ["Splendid!", "You\u2019ve mastered it!"]];
static var Jam = [[[244, 258, 148, 234]], [[104, 258, 114, 240]], [[114, 0, 122, 168], [286, 320, 122, 172]], [[314, 356, 78, 138], [242, 0, 72, 156]], [[82, 0, 72, 238], [244, 0, 70, 238], [406, 0, 68, 238]], [[0, 180, 166, 98]]];
static var LEVEL_THRESHOLDS = [[8, 4], [3, 3], [8, 3], [4, 2], [6, 3], [6, 2]];
static var LEVEL1_TARGET = 25;
static var LEVEL1_TIME = 0;
static var LEVEL1_SIGNALS = [[340, 220, 254, 0]];
static var LEVEL1_ROADS = [[UP, 0, 0, [258], [0], 7], [UP, 0, 0, [310], [0], 8], [UP, 0, 0, [358], [0], 9], [RIGHT, -1, 0, [160], [], 9]];
static var LEVEL1_INTERSECTIONS = [[238, 128, 160, 80]];
static var LEVEL2_TARGET = 35;
static var LEVEL2_TIME = 0;
static var LEVEL2_SIGNALS = [[165, 240, 274, 0]];
static var LEVEL2_ROADS = [[UP, 0, 0, [124], [0], 9], [UP, 0, 0, [180], [0], 9], [LEFT, -1, 0, [106], [], 6], [LEFT, -1, 0, [146], [], 9], [LEFT, -1, 0, [186], [], 9], [LEFT, -1, 0, [216], [], 9]];
static var LEVEL2_INTERSECTIONS = [[96, 74, 130, 162]];
static var LEVEL3_TARGET = 40;
static var LEVEL3_TIME = 0;
static var LEVEL3_SIGNALS = [[171, 194, 158, 180], [355, 286, 322, 0]];
static var LEVEL3_ROADS = [[DOWN, 0, 0, [160], [0], 9], [UP, 1, 0, [302], [1], 9], [DOWN, 0, 0, [210], [0], 9], [UP, 1, 0, [358], [1], 9], [RIGHT, -1, 0, [230], [], 6]];
static var LEVEL3_INTERSECTIONS = [[108, 200, 306, 86]];
static var LEVEL4_TARGET = 50;
static var LEVEL4_TIME = 0;
static var LEVEL4_SIGNALS = [[295, 176, 154, 180], [335, 326, 358, 0]];
static var LEVEL4_ROADS = [[DOWN, 1, 0, [272], [0], 9], [DOWN, 1, 0, [308], [0], 9], [UP, 0, 0, [324], [1], 9], [UP, 0, 0, [356], [1], 9], [LEFT, -1, 0, [234], [], 6], [RIGHT, -1, 0, [272], [], 9]];
static var LEVEL4_INTERSECTIONS = [[234, 190, 160, 130]];
static var LEVEL5_TARGET = 45;
static var LEVEL5_TIME = 0;
static var LEVEL5_SIGNALS = [[136, 270, 238, 180], [300, 270, 238, 180], [455, 270, 238, 180]];
static var LEVEL5_ROADS = [[DOWN, 0, 0, [120], [0], 9], [DOWN, 1, 0, [284], [1], 9], [DOWN, 2, 0, [448], [2], 8], [RIGHT, -1, 0, [290], [], 7], [RIGHT, -1, 0, [354], [], 7]];
static var LEVEL5_INTERSECTIONS = [[80, 268, 400, 130]];
static var LEVEL6_TARGET = 40;
static var LEVEL6_TIME = 0;
static var LEVEL6_SIGNALS = [[188, 224, 160, 90], [508, 224, 482, 90]];
static var LEVEL6_ROADS = [[DOWN, -1, 0, [238], [], 9], [DOWN, -1, 0, [560], [], 9], [UP, -1, 0, [272], [], 6], [UP, -1, 0, [590], [], 9], [RIGHT, 0, 0, [200], [0, 1], 9], [RIGHT, 0, 0, [248], [0, 1], 9]];
static var LEVEL6_INTERSECTIONS = [[190, 174, 130, 106], [510, 174, 130, 106]];
}
Symbol 934 MovieClip [__Packages.Game] Frame 0
class Game extends MovieClip
{
static var stageHeight, stageWidth;
var trafficJamSound, non, prev, loseSema, winSema, levelTimes, finishedLevels, gotoAndStop, currentLevel, level1screenshot, attachMovie, levelTarget, totalTime, currentTime, i, bg, lights, intersections, getNextHighestDepth, signal, road, signals, car, timer, levelTimer, delegateOnGameOver, delegetOnCarReachingExtreme, delegateOnCollision, winTimer, loseTimer, createEmptyMovieClip, popUpTimer;
function Game () {
super();
SoundFX.initialize();
trafficJamSound = new Sound();
trafficJamSound.attachSound("TrafficJamSound");
non = 0;
prev = 0;
SoundFX.playMenuBackground();
loseSema = true;
winSema = true;
levelTimes = new Array(6);
var _local3 = 0;
while (_local3 < levelTimes.length) {
levelTimes[_local3] = 0;
_local3++;
}
finishedLevels = "";
}
function loadStartScreen() {
gotoAndStop("game");
_root.showScreen("startscreen");
}
function Level1() {
currentLevel = 1;
stageHeight = 490;
stageWidth = 640;
level1screenshot = attachMovie("Level1screenshot", "Level1screenshot", 2000);
_root.hideScreen();
levelTarget = GameConstants.LEVEL1_TARGET;
_root.scoretxt.text = "Target : " + levelTarget;
totalTime = GameConstants.LEVEL1_TIME;
currentTime = 0;
changeTimer();
carsPassed = 0;
i = 0;
bg = attachMovie("Level1BG", "Level1BG", GameConstants.BG_DEPTH);
lights = attachMovie("Level1Lights", "Level1Lights", GameConstants.LIGHT_DEPTH);
_root.showScreen("");
SoundFX.playGameBackground(1);
}
function actualLevel1() {
var _local3;
var _local4;
_root.showscoretxt();
level1screenshot.removeMovieClip();
intersections = new Array(GameConstants.LEVEL1_INTERSECTIONS.length);
_local3 = 0;
while (_local3 < intersections.length) {
intersections[_local3] = attachMovie("IntersectionCollisionDetector", "IntersectionCollisionDetector" + _local3, getNextHighestDepth());
intersections[_local3].initialize(GameConstants.LEVEL1_INTERSECTIONS[_local3][2], GameConstants.LEVEL1_INTERSECTIONS[_local3][3]);
intersections[_local3]._x = GameConstants.LEVEL1_INTERSECTIONS[_local3][0];
intersections[_local3]._y = GameConstants.LEVEL1_INTERSECTIONS[_local3][1];
_local3++;
}
signal = new Array(GameConstants.LEVEL1_SIGNALS.length);
_local3 = 0;
while (_local3 < signal.length) {
signal[_local3] = attachMovie("Signal", "Signal" + _local3, GameConstants.SIGNAL_DEPTH + _local3);
signal[_local3].initialize(_local3, GameConstants.LEVEL1_SIGNALS[_local3][3]);
signal[_local3]._x = GameConstants.LEVEL1_SIGNALS[_local3][0];
signal[_local3]._y = GameConstants.LEVEL1_SIGNALS[_local3][1];
signal[_local3].limit = GameConstants.LEVEL1_SIGNALS[_local3][2];
_local3++;
}
road = new Array(GameConstants.LEVEL1_ROADS.length);
signals = new Array(GameConstants.LEVEL1_ROADS.length);
_local3 = 0;
while (_local3 < GameConstants.LEVEL1_ROADS.length) {
signals[_local3] = new Array(GameConstants.LEVEL1_ROADS[_local3][4].length);
_local4 = 0;
while (_local4 < signals[_local3].length) {
signals[_local3][_local4] = signal[GameConstants.LEVEL1_ROADS[_local3][4][_local4]];
_local4++;
}
if (signals[_local3].length == 0) {
signals[_local3] = null;
}
road[_local3] = new Road(_local3, signals[_local3], GameConstants.LEVEL1_ROADS[_local3][0], GameConstants.LEVEL1_ROADS[_local3][3], GameConstants.LEVEL1_ROADS[_local3][5], intersections, GameConstants.LEVEL1_ROADS[_local3][1]);
_local3++;
}
car = new Array(200);
timer = setInterval(this, "onTimer", 450);
levelTimer = setInterval(this, "onLevelTimer", 1000);
delegateOnGameOver = mx.utils.Delegate.create(this, onGameOver);
delegetOnCarReachingExtreme = mx.utils.Delegate.create(this, onCarReachingExtreme);
delegateOnCollision = mx.utils.Delegate.create(this, onCollision);
CustomEventDispatcher.addEventListener(CustomEvents.GAME_OVER, delegateOnGameOver);
CustomEventDispatcher.addEventListener(CustomEvents.CAR_REACHED_EXTREME, delegetOnCarReachingExtreme);
CustomEventDispatcher.addEventListener(CustomEvents.COLLISION, delegateOnCollision);
}
function Level2() {
var _local3;
var _local4;
SoundFX.playGameBackground(1);
currentLevel = 2;
levelTarget = GameConstants.LEVEL2_TARGET;
_root.scoretxt.text = "Target : " + levelTarget;
totalTime = GameConstants.LEVEL2_TIME;
currentTime = 0;
changeTimer();
carsPassed = 0;
i = 0;
stageHeight = 490;
stageWidth = 640;
_root.hideScreen();
_root.showscoretxt();
bg = attachMovie("Level2BG", "Level2BG", GameConstants.BG_DEPTH);
lights = attachMovie("Level2Lights", "Level2Lights", GameConstants.LIGHT_DEPTH);
intersections = new Array(GameConstants.LEVEL2_INTERSECTIONS.length);
_local3 = 0;
while (_local3 < intersections.length) {
intersections[_local3] = attachMovie("IntersectionCollisionDetector", "IntersectionCollisionDetector" + _local3, getNextHighestDepth());
intersections[_local3].initialize(GameConstants.LEVEL2_INTERSECTIONS[_local3][2], GameConstants.LEVEL2_INTERSECTIONS[_local3][3]);
intersections[_local3]._x = GameConstants.LEVEL2_INTERSECTIONS[_local3][0];
intersections[_local3]._y = GameConstants.LEVEL2_INTERSECTIONS[_local3][1];
_local3++;
}
signal = new Array(GameConstants.LEVEL2_SIGNALS.length);
_local3 = 0;
while (_local3 < signal.length) {
signal[_local3] = attachMovie("Signal", "Signal" + _local3, GameConstants.SIGNAL_DEPTH + _local3);
signal[_local3].initialize(_local3, GameConstants.LEVEL2_SIGNALS[_local3][3]);
signal[_local3]._x = GameConstants.LEVEL2_SIGNALS[_local3][0];
signal[_local3]._y = GameConstants.LEVEL2_SIGNALS[_local3][1];
signal[_local3].limit = GameConstants.LEVEL2_SIGNALS[_local3][2];
_local3++;
}
road = new Array(GameConstants.LEVEL2_ROADS.length);
signals = new Array(GameConstants.LEVEL2_ROADS.length);
_local3 = 0;
while (_local3 < GameConstants.LEVEL2_ROADS.length) {
signals[_local3] = new Array(GameConstants.LEVEL2_ROADS[_local3][4].length);
_local4 = 0;
while (_local4 < signals[_local3].length) {
signals[_local3][_local4] = signal[GameConstants.LEVEL2_ROADS[_local3][4][_local4]];
_local4++;
}
if (signals[_local3].length == 0) {
signals[_local3] = null;
}
road[_local3] = new Road(_local3, signals[_local3], GameConstants.LEVEL2_ROADS[_local3][0], GameConstants.LEVEL2_ROADS[_local3][3], GameConstants.LEVEL2_ROADS[_local3][5], intersections, GameConstants.LEVEL2_ROADS[_local3][1]);
_local3++;
}
car = new Array(200);
timer = setInterval(this, "onTimer", 450);
levelTimer = setInterval(this, "onLevelTimer", 1000);
delegateOnGameOver = mx.utils.Delegate.create(this, onGameOver);
delegetOnCarReachingExtreme = mx.utils.Delegate.create(this, onCarReachingExtreme);
delegateOnCollision = mx.utils.Delegate.create(this, onCollision);
CustomEventDispatcher.addEventListener(CustomEvents.GAME_OVER, delegateOnGameOver);
CustomEventDispatcher.addEventListener(CustomEvents.CAR_REACHED_EXTREME, delegetOnCarReachingExtreme);
CustomEventDispatcher.addEventListener(CustomEvents.COLLISION, delegateOnCollision);
}
function Level3() {
var _local3;
var _local4;
SoundFX.playGameBackground(1);
currentLevel = 3;
levelTarget = GameConstants.LEVEL3_TARGET;
_root.scoretxt.text = "Target : " + levelTarget;
totalTime = GameConstants.LEVEL3_TIME;
currentTime = 0;
changeTimer();
carsPassed = 0;
i = 0;
stageHeight = 490;
stageWidth = 640;
_root.hideScreen();
_root.showscoretxt();
bg = attachMovie("Level3BG", "Level3BG", GameConstants.BG_DEPTH);
lights = attachMovie("Level3Lights", "Level3Lights", GameConstants.LIGHT_DEPTH);
intersections = new Array(GameConstants.LEVEL3_INTERSECTIONS.length);
_local3 = 0;
while (_local3 < intersections.length) {
intersections[_local3] = attachMovie("IntersectionCollisionDetector", "IntersectionCollisionDetector" + _local3, getNextHighestDepth());
intersections[_local3].initialize(GameConstants.LEVEL3_INTERSECTIONS[_local3][2], GameConstants.LEVEL3_INTERSECTIONS[_local3][3]);
intersections[_local3]._x = GameConstants.LEVEL3_INTERSECTIONS[_local3][0];
intersections[_local3]._y = GameConstants.LEVEL3_INTERSECTIONS[_local3][1];
_local3++;
}
signal = new Array(GameConstants.LEVEL3_SIGNALS.length);
_local3 = 0;
while (_local3 < signal.length) {
signal[_local3] = attachMovie("Signal", "Signal" + _local3, GameConstants.SIGNAL_DEPTH + _local3);
signal[_local3].initialize(_local3, GameConstants.LEVEL3_SIGNALS[_local3][3]);
signal[_local3]._x = GameConstants.LEVEL3_SIGNALS[_local3][0];
signal[_local3]._y = GameConstants.LEVEL3_SIGNALS[_local3][1];
signal[_local3].limit = GameConstants.LEVEL3_SIGNALS[_local3][2];
_local3++;
}
road = new Array(GameConstants.LEVEL3_ROADS.length);
signals = new Array(GameConstants.LEVEL3_ROADS.length);
_local3 = 0;
while (_local3 < GameConstants.LEVEL3_ROADS.length) {
signals[_local3] = new Array(GameConstants.LEVEL3_ROADS[_local3][4].length);
_local4 = 0;
while (_local4 < signals[_local3].length) {
signals[_local3][_local4] = signal[GameConstants.LEVEL3_ROADS[_local3][4][_local4]];
_local4++;
}
if (signals[_local3].length == 0) {
signals[_local3] = null;
}
road[_local3] = new Road(_local3, signals[_local3], GameConstants.LEVEL3_ROADS[_local3][0], GameConstants.LEVEL3_ROADS[_local3][3], GameConstants.LEVEL3_ROADS[_local3][5], intersections, GameConstants.LEVEL3_ROADS[_local3][1]);
_local3++;
}
car = new Array(200);
timer = setInterval(this, "onTimer", 500);
levelTimer = setInterval(this, "onLevelTimer", 1000);
delegateOnGameOver = mx.utils.Delegate.create(this, onGameOver);
delegetOnCarReachingExtreme = mx.utils.Delegate.create(this, onCarReachingExtreme);
delegateOnCollision = mx.utils.Delegate.create(this, onCollision);
CustomEventDispatcher.addEventListener(CustomEvents.GAME_OVER, delegateOnGameOver);
CustomEventDispatcher.addEventListener(CustomEvents.CAR_REACHED_EXTREME, delegetOnCarReachingExtreme);
CustomEventDispatcher.addEventListener(CustomEvents.COLLISION, delegateOnCollision);
}
function Level4() {
var _local3;
var _local4;
SoundFX.playGameBackground(1);
currentLevel = 4;
levelTarget = GameConstants.LEVEL4_TARGET;
_root.scoretxt.text = "Target : " + levelTarget;
totalTime = GameConstants.LEVEL4_TIME;
currentTime = 0;
changeTimer();
carsPassed = 0;
i = 0;
stageHeight = 490;
stageWidth = 640;
_root.hideScreen();
_root.showscoretxt();
bg = attachMovie("Level4BG", "Level4BG", GameConstants.BG_DEPTH);
lights = attachMovie("Level4Lights", "Level4Lights", GameConstants.LIGHT_DEPTH);
intersections = new Array(GameConstants.LEVEL4_INTERSECTIONS.length);
_local3 = 0;
while (_local3 < intersections.length) {
intersections[_local3] = attachMovie("IntersectionCollisionDetector", "IntersectionCollisionDetector" + _local3, getNextHighestDepth());
intersections[_local3].initialize(GameConstants.LEVEL4_INTERSECTIONS[_local3][2], GameConstants.LEVEL4_INTERSECTIONS[_local3][3]);
intersections[_local3]._x = GameConstants.LEVEL4_INTERSECTIONS[_local3][0];
intersections[_local3]._y = GameConstants.LEVEL4_INTERSECTIONS[_local3][1];
_local3++;
}
signal = new Array(GameConstants.LEVEL4_SIGNALS.length);
_local3 = 0;
while (_local3 < signal.length) {
signal[_local3] = attachMovie("Signal", "Signal" + _local3, GameConstants.SIGNAL_DEPTH + _local3);
signal[_local3].initialize(_local3, GameConstants.LEVEL4_SIGNALS[_local3][3]);
signal[_local3]._x = GameConstants.LEVEL4_SIGNALS[_local3][0];
signal[_local3]._y = GameConstants.LEVEL4_SIGNALS[_local3][1];
signal[_local3].limit = GameConstants.LEVEL4_SIGNALS[_local3][2];
_local3++;
}
road = new Array(GameConstants.LEVEL4_ROADS.length);
signals = new Array(GameConstants.LEVEL4_ROADS.length);
_local3 = 0;
while (_local3 < GameConstants.LEVEL4_ROADS.length) {
signals[_local3] = new Array(GameConstants.LEVEL4_ROADS[_local3][4].length);
_local4 = 0;
while (_local4 < signals[_local3].length) {
signals[_local3][_local4] = signal[GameConstants.LEVEL4_ROADS[_local3][4][_local4]];
_local4++;
}
if (signals[_local3].length == 0) {
signals[_local3] = null;
}
road[_local3] = new Road(_local3, signals[_local3], GameConstants.LEVEL4_ROADS[_local3][0], GameConstants.LEVEL4_ROADS[_local3][3], GameConstants.LEVEL4_ROADS[_local3][5], intersections, GameConstants.LEVEL4_ROADS[_local3][1]);
_local3++;
}
car = new Array(200);
timer = setInterval(this, "onTimer", 500);
levelTimer = setInterval(this, "onLevelTimer", 1000);
delegateOnGameOver = mx.utils.Delegate.create(this, onGameOver);
delegetOnCarReachingExtreme = mx.utils.Delegate.create(this, onCarReachingExtreme);
delegateOnCollision = mx.utils.Delegate.create(this, onCollision);
CustomEventDispatcher.addEventListener(CustomEvents.GAME_OVER, delegateOnGameOver);
CustomEventDispatcher.addEventListener(CustomEvents.CAR_REACHED_EXTREME, delegetOnCarReachingExtreme);
CustomEventDispatcher.addEventListener(CustomEvents.COLLISION, delegateOnCollision);
}
function Level5() {
var _local3;
var _local4;
SoundFX.playGameBackground(1);
currentLevel = 5;
levelTarget = GameConstants.LEVEL5_TARGET;
_root.scoretxt.text = "Target : " + levelTarget;
totalTime = GameConstants.LEVEL5_TIME;
currentTime = 0;
changeTimer();
carsPassed = 0;
i = 0;
stageHeight = 490;
stageWidth = 640;
_root.hideScreen();
_root.showscoretxt();
bg = attachMovie("Level5BG", "Level5BG", GameConstants.BG_DEPTH);
lights = attachMovie("Level5Lights", "Level5Lights", GameConstants.LIGHT_DEPTH);
intersections = new Array(GameConstants.LEVEL5_INTERSECTIONS.length);
_local3 = 0;
while (_local3 < intersections.length) {
intersections[_local3] = attachMovie("IntersectionCollisionDetector", "IntersectionCollisionDetector" + _local3, getNextHighestDepth());
intersections[_local3].initialize(GameConstants.LEVEL5_INTERSECTIONS[_local3][2], GameConstants.LEVEL5_INTERSECTIONS[_local3][3]);
intersections[_local3]._x = GameConstants.LEVEL5_INTERSECTIONS[_local3][0];
intersections[_local3]._y = GameConstants.LEVEL5_INTERSECTIONS[_local3][1];
_local3++;
}
signal = new Array(GameConstants.LEVEL5_SIGNALS.length);
_local3 = 0;
while (_local3 < signal.length) {
signal[_local3] = attachMovie("Signal", "Signal" + _local3, GameConstants.SIGNAL_DEPTH + _local3);
signal[_local3].initialize(_local3, GameConstants.LEVEL5_SIGNALS[_local3][3]);
signal[_local3]._x = GameConstants.LEVEL5_SIGNALS[_local3][0];
signal[_local3]._y = GameConstants.LEVEL5_SIGNALS[_local3][1];
signal[_local3].limit = GameConstants.LEVEL5_SIGNALS[_local3][2];
_local3++;
}
road = new Array(GameConstants.LEVEL5_ROADS.length);
signals = new Array(GameConstants.LEVEL5_ROADS.length);
_local3 = 0;
while (_local3 < GameConstants.LEVEL5_ROADS.length) {
signals[_local3] = new Array(GameConstants.LEVEL5_ROADS[_local3][4].length);
_local4 = 0;
while (_local4 < signals[_local3].length) {
signals[_local3][_local4] = signal[GameConstants.LEVEL5_ROADS[_local3][4][_local4]];
_local4++;
}
if (signals[_local3].length == 0) {
signals[_local3] = null;
}
road[_local3] = new Road(_local3, signals[_local3], GameConstants.LEVEL5_ROADS[_local3][0], GameConstants.LEVEL5_ROADS[_local3][3], GameConstants.LEVEL5_ROADS[_local3][5], intersections, GameConstants.LEVEL5_ROADS[_local3][1]);
_local3++;
}
car = new Array(200);
timer = setInterval(this, "onTimer", 500);
levelTimer = setInterval(this, "onLevelTimer", 1000);
delegateOnGameOver = mx.utils.Delegate.create(this, onGameOver);
delegetOnCarReachingExtreme = mx.utils.Delegate.create(this, onCarReachingExtreme);
delegateOnCollision = mx.utils.Delegate.create(this, onCollision);
CustomEventDispatcher.addEventListener(CustomEvents.GAME_OVER, delegateOnGameOver);
CustomEventDispatcher.addEventListener(CustomEvents.CAR_REACHED_EXTREME, delegetOnCarReachingExtreme);
CustomEventDispatcher.addEventListener(CustomEvents.COLLISION, delegateOnCollision);
}
function Level6() {
var _local3;
var _local4;
SoundFX.playGameBackground(1);
currentLevel = 6;
levelTarget = GameConstants.LEVEL6_TARGET;
_root.scoretxt.text = "Target : " + levelTarget;
totalTime = GameConstants.LEVEL6_TIME;
currentTime = 0;
changeTimer();
carsPassed = 0;
i = 0;
stageHeight = 490;
stageWidth = 640;
_root.hideScreen();
_root.showscoretxt();
bg = attachMovie("Level6BG", "Level6BG", GameConstants.BG_DEPTH);
lights = attachMovie("Level6Lights", "Level6Lights", GameConstants.LIGHT_DEPTH);
intersections = new Array(GameConstants.LEVEL6_INTERSECTIONS.length);
_local3 = 0;
while (_local3 < intersections.length) {
intersections[_local3] = attachMovie("IntersectionCollisionDetector", "IntersectionCollisionDetector" + _local3, getNextHighestDepth());
intersections[_local3].initialize(GameConstants.LEVEL6_INTERSECTIONS[_local3][2], GameConstants.LEVEL6_INTERSECTIONS[_local3][3]);
intersections[_local3]._x = GameConstants.LEVEL6_INTERSECTIONS[_local3][0];
intersections[_local3]._y = GameConstants.LEVEL6_INTERSECTIONS[_local3][1];
_local3++;
}
signal = new Array(GameConstants.LEVEL6_SIGNALS.length);
_local3 = 0;
while (_local3 < signal.length) {
signal[_local3] = attachMovie("Signal", "Signal" + _local3, GameConstants.SIGNAL_DEPTH + _local3);
signal[_local3].initialize(_local3, GameConstants.LEVEL6_SIGNALS[_local3][3]);
signal[_local3]._x = GameConstants.LEVEL6_SIGNALS[_local3][0];
signal[_local3]._y = GameConstants.LEVEL6_SIGNALS[_local3][1];
signal[_local3].limit = GameConstants.LEVEL6_SIGNALS[_local3][2];
_local3++;
}
road = new Array(GameConstants.LEVEL6_ROADS.length);
signals = new Array(GameConstants.LEVEL6_ROADS.length);
_local3 = 0;
while (_local3 < GameConstants.LEVEL6_ROADS.length) {
signals[_local3] = new Array(GameConstants.LEVEL6_ROADS[_local3][4].length);
_local4 = 0;
while (_local4 < signals[_local3].length) {
signals[_local3][_local4] = signal[GameConstants.LEVEL6_ROADS[_local3][4][_local4]];
_local4++;
}
if (signals[_local3].length == 0) {
signals[_local3] = null;
}
road[_local3] = new Road(_local3, signals[_local3], GameConstants.LEVEL6_ROADS[_local3][0], GameConstants.LEVEL6_ROADS[_local3][3], GameConstants.LEVEL6_ROADS[_local3][5], intersections, GameConstants.LEVEL6_ROADS[_local3][1]);
_local3++;
}
car = new Array(200);
timer = setInterval(this, "onTimer", 500);
levelTimer = setInterval(this, "onLevelTimer", 1000);
delegateOnGameOver = mx.utils.Delegate.create(this, onGameOver);
delegetOnCarReachingExtreme = mx.utils.Delegate.create(this, onCarReachingExtreme);
delegateOnCollision = mx.utils.Delegate.create(this, onCollision);
CustomEventDispatcher.addEventListener(CustomEvents.GAME_OVER, delegateOnGameOver);
CustomEventDispatcher.addEventListener(CustomEvents.CAR_REACHED_EXTREME, delegetOnCarReachingExtreme);
CustomEventDispatcher.addEventListener(CustomEvents.COLLISION, delegateOnCollision);
}
function clearLevel() {
var _local3;
clearInterval(timer);
timer = 0;
clearInterval(levelTimer);
levelTimer = 0;
clearInterval(winTimer);
clearInterval(loseTimer);
SoundFX.stopBackgroundImmediate();
_root.timermc.timetxt.text = "00 : 00";
_root.hidescoretxt();
CustomEventDispatcher.removeEventListener(CustomEvents.GAME_OVER, delegateOnGameOver);
CustomEventDispatcher.removeEventListener(CustomEvents.CAR_REACHED_EXTREME, delegetOnCarReachingExtreme);
CustomEventDispatcher.removeEventListener(CustomEvents.COLLISION, delegateOnCollision);
_local3 = 0;
while (_local3 < signal.length) {
signal[_local3].removeClickEventListener();
_local3++;
}
_local3 = 0;
while (_local3 < i) {
if (car[_local3]) {
car[_local3].stopMe();
}
_local3++;
}
bg.removeMovieClip();
lights.removeMovieClip();
_local3 = 0;
while (_local3 < intersections.length) {
intersections[_local3].removeMovieClip();
_local3++;
}
intersections = undefined;
_local3 = 0;
while (_local3 < signal.length) {
signal[_local3].removeMovieClip();
_local3++;
}
signal = undefined;
_local3 = 0;
while (_local3 < i) {
car[_local3].removeMovieClip();
_local3++;
}
car = undefined;
_local3 = 0;
while (_local3 < road.length) {
road[_local3].clearRoad();
_local3++;
}
road = undefined;
i = 0;
}
function restartLevel() {
clearLevel();
if (currentLevel == 1) {
Level1();
} else if (currentLevel == 2) {
Level2();
} else if (currentLevel == 3) {
Level3();
} else if (currentLevel == 4) {
Level4();
} else if (currentLevel == 5) {
Level5();
} else if (currentLevel == 6) {
Level6();
}
}
function onTimer() {
var _local2;
car[i] = attachMovie("Vehicle", "car" + i, GameConstants.CAR_DEPTH + i);
car[i].id = i;
_local2 = getRandomRoad();
car[i].road = _local2;
road[_local2].addToLane(car[i]);
i++;
}
function getRandomRoad() {
if (currentLevel != 6) {
return(Binomial(road.length - 1, Math.random()));
}
return(Scant(0, road.length - 1));
}
function Scant(a, b) {
var _local2 = 0;
_local2 = a;
while (_local2 <= b) {
if (road[_local2].signalInfo && (prev != _local2)) {
if (Bernoulli(Math.random())) {
prev = _local2;
return(_local2);
}
}
_local2++;
}
_local2 = a;
while (_local2 <= b) {
if ((!road[_local2].signalInfo) && (prev != _local2)) {
if (Bernoulli(Math.random())) {
prev = _local2;
return(_local2);
}
}
_local2++;
}
return(random(road.length - 1));
}
function Equilikely(a, b) {
var _local1;
_local1 = a + int(((b - a) + 1) * Math.random());
return(_local1);
}
function Bernoulli(p) {
return(((Math.random() < (1 - p)) ? 0 : 1));
}
function Binomial(n, p) {
var _local2 = 0;
var _local3 = 0;
_local2 = 0;
while (_local2 < n) {
_local3 = _local3 + Bernoulli(p);
_local2++;
}
return(_local3);
}
function changeTimer() {
var _local5;
var _local4;
var _local3;
_local5 = int(currentTime / 3600);
_local4 = int((currentTime % 3600) / 60);
_local3 = int((currentTime % 3600) % 60);
_root.timermc.timetxt.text = (((_local4 < 10) ? ("0" + _local4) : (_local4)) + " : ") + ((_local3 < 10) ? ("0" + _local3) : (_local3));
}
function onLevelTimer() {
var _local2 = 0;
currentTime++;
changeTimer();
}
function showTrafficJam(r) {
var trjam = createEmptyMovieClip("trjam", 125);
trjam.lineStyle(3, 16711680, 0);
trjam.beginFill(16711680, 60);
trjam.moveTo(0, 0);
if (r.jamInfo != -1) {
trjam.lineTo(GameConstants.Jam[currentLevel - 1][r.jamInfo][2], 0);
trjam.lineTo(GameConstants.Jam[currentLevel - 1][r.jamInfo][2], GameConstants.Jam[currentLevel - 1][r.jamInfo][3]);
trjam.lineTo(0, GameConstants.Jam[currentLevel - 1][r.jamInfo][3]);
trjam.lineTo(0, 0);
trjam._y = GameConstants.Jam[currentLevel - 1][r.jamInfo][1];
trjam._x = GameConstants.Jam[currentLevel - 1][r.jamInfo][0];
trjam.endFill();
var trjamtween1 = (new mx.transitions.Tween(trjam, "_alpha", mx.transitions.easing.Bounce.easeInOut, 60, 0, 1, true));
trjamtween1.onMotionFinished = function () {
trjamtween1.stop();
var trjamtween2 = (new mx.transitions.Tween(trjam, "_alpha", mx.transitions.easing.Bounce.easeInOut, 0, 60, 1, true));
trjamtween2.onMotionFinished = function () {
trjamtween2.stop();
trjam.removeMovieClip();
};
};
}
}
function onGameOver(ce) {
var _local3 = 0;
if (!road[ce.data.object.road].signalInfo) {
}
if (road[ce.data.object.road].signalInfo) {
CustomEventDispatcher.removeEventListener(CustomEvents.GAME_OVER, delegateOnGameOver);
if (!SoundFX.muteMusic) {
SoundFX.stopBackgroundImmediate();
trafficJamSound.start(0, 1);
}
showTrafficJam(road[ce.data.object.road]);
clearInterval(timer);
timer = 0;
clearInterval(levelTimer);
levelTimer = 0;
_local3 = 0;
while (_local3 < signal.length) {
signal[_local3].removeClickEventListener();
_local3++;
}
_local3 = 0;
while (_local3 < i) {
if (car[_local3]) {
car[_local3].stopMe();
}
_local3++;
}
popUpTimer = setInterval(this, "showPopUp", 2500, _root, "Traffic Jam!");
loseTimer = setInterval(this, "showLoseScreen", 4000, _root, "jam");
}
}
function showPopUp(object, str) {
clearInterval(popUpTimer);
object.showScreen("popUp");
object.mc.info.autoSize = "center";
object.mc.info.wordWrap = true;
object.mc._x = 222;
object.mc._y = 164;
object.mc.lost.text = str;
}
function onCollision(ce) {
var _local3 = 0;
CustomEventDispatcher.removeEventListener(CustomEvents.COLLISION, delegateOnCollision);
clearInterval(timer);
timer = 0;
clearInterval(levelTimer);
levelTimer = 0;
_local3 = 0;
while (_local3 < signal.length) {
signal[_local3].removeClickEventListener();
_local3++;
}
_local3 = 0;
while (_local3 < i) {
if (car[_local3]) {
car[_local3].stopMe();
}
_local3++;
}
popUpTimer = setInterval(this, "showPopUp", 2500, _root, "Accident!");
loseTimer = setInterval(this, "showLoseScreen", 4000, _root, "accident");
}
function showLoseScreen(object, str) {
if (loseSema) {
loseSema = false;
clearInterval(loseTimer);
SoundFX.playSadBackground();
_root.showScreen("losescreen");
if (str == "accident") {
object.mc.gotoAndStop("Accident");
} else if (str == "jam") {
object.mc.gotoAndStop("Jam");
} else {
object.mc.gotoAndStop(1);
}
loseSema = true;
}
}
function showMapScreen() {
if (winSema) {
winSema = false;
clearInterval(winTimer);
if (currentLevel != 6) {
SoundFX.playMenuBackground();
if (finishedLevels.indexOf(currentLevel + "") == -1) {
finishedLevels = finishedLevels + ("" + currentLevel);
}
_root.showScreen("LevelSelector");
} else {
_root.showScreen("winscreen");
SoundFX.playGameBackground(2);
}
winSema = true;
}
}
function onCarReachingExtreme(ce) {
var _local3 = 0;
var _local5 = false;
var _local4 = ce.data.object;
if (_local4.__get__signalId()) {
_local5 = true;
}
_local4.stopMe();
road[_local4.__get__road()].removeFromLane(_local4);
_local4.removeMovieClip();
_local4 = undefined;
if (_local5) {
carsPassed++;
_root.scoretxt.text = "Target : " + (levelTarget - carsPassed);
}
if (carsPassed >= levelTarget) {
if (currentLevel != 6) {
_root.showScreen("popUp");
_root.mc.info.autoSize = "center";
_root.mc.info.wordWrap = true;
_root.mc._x = 222;
_root.mc._y = 164;
_root.mc.info.text = GameConstants.winMsg[currentLevel - 1][0];
_root.mc.addi.text = GameConstants.winMsg[currentLevel - 1][1];
} else {
_root.showScreen("");
}
clearInterval(timer);
timer = 0;
clearInterval(levelTimer);
levelTimer = 0;
_local3 = 0;
while (_local3 < signal.length) {
signal[_local3].removeClickEventListener();
_local3++;
}
_local3 = 0;
while (_local3 < i) {
if (car[_local3]) {
car[_local3].stopMe();
}
_local3++;
}
winTimer = setInterval(this, "showMapScreen", 2000);
levelTimes[currentLevel - 1] = currentTime;
}
}
var carsPassed = 0;
}
Symbol 935 MovieClip [__Packages.Road] Frame 0
class Road extends MovieClip
{
var crossSignalEventSender, roadId, lanes, toFollowSignal, jamInfo, direction, _signalInfo, _speed, actualIntersection, _currentLimit, _newLimit, _vehicleCollection, delegateOnOneVehicleStop, delegateOnOneVehicleStarted, delegateOnOneVehicleCrossSignal;
function Road (roadId, _signalInfo, _direction, _laneInfo, _speed, _intersections, _jam) {
super();
crossSignalEventSender = null;
this.roadId = roadId;
lanes = _laneInfo;
toFollowSignal = 0;
jamInfo = _jam;
direction = _direction;
this._signalInfo = _signalInfo;
this._speed = _speed;
actualIntersection = new Array();
var _local3 = 0;
while (_local3 < _intersections.length) {
if ((direction == 0) || (direction == 2)) {
if ((_laneInfo && (_intersections[_local3]._x < _laneInfo[0])) && (_laneInfo[0] < (_intersections[_local3]._x + _intersections[_local3]._width))) {
actualIntersection.push(_intersections[_local3]);
}
}
if ((direction == 1) || (direction == 3)) {
if ((_laneInfo && (_intersections[_local3]._y < _laneInfo[0])) && (_laneInfo[0] < (_intersections[_local3]._y + _intersections[_local3]._height))) {
actualIntersection.push(_intersections[_local3]);
}
}
_local3++;
}
if (_signalInfo) {
_currentLimit = new Array(_signalInfo.length);
_newLimit = new Array(_signalInfo.length);
var _local5 = 0;
while (_local5 < _currentLimit.length) {
_currentLimit[_local5] = _signalInfo[_local5].limit;
_newLimit[_local5] = _signalInfo[_local5].limit;
_local5++;
}
}
_vehicleCollection = new Array();
delegateOnOneVehicleStop = mx.utils.Delegate.create(this, onOneVehicleStop);
delegateOnOneVehicleStarted = mx.utils.Delegate.create(this, onOneVehicleStarted);
delegateOnOneVehicleCrossSignal = mx.utils.Delegate.create(this, onOneVehicleCrossSignal);
CustomEventDispatcher.addEventListener(CustomEvents.VEHICLE_STOPED, delegateOnOneVehicleStop);
CustomEventDispatcher.addEventListener(CustomEvents.VEHICLE_STARTED, delegateOnOneVehicleStarted);
CustomEventDispatcher.addEventListener(CustomEvents.PLEASE_CHANGE_MY_SIGNAL, delegateOnOneVehicleCrossSignal);
}
function onOneVehicleCrossSignal(ce) {
var _local4 = -1;
var _local3 = 0;
while (_local3 < _vehicleCollection.length) {
if (_vehicleCollection[_local3] == ce.data.object) {
_local4 = _local3;
break;
}
_local3++;
}
if (_local4 != -1) {
if (_signalInfo) {
var _local5 = -1;
var _local2 = 0;
while (_local2 < _signalInfo.length) {
if (_signalInfo[_local2].id == ce.data.object.signalId) {
_local5 = _local2;
break;
}
_local2++;
}
if ((_local5 != -1) && ((_local5 + 1) < _signalInfo.length)) {
_vehicleCollection[_local4].signalId = _signalInfo[_local5 + 1].id;
_vehicleCollection[_local4].original = _signalInfo[_local5 + 1].limit;
_vehicleCollection[_local4].limitLine = _newLimit[_local5 + 1];
_vehicleCollection[_local4].signal = _signalInfo[_local5 + 1].state;
} else {
toFollowSignal--;
_vehicleCollection[_local4].signalId = -1;
_vehicleCollection[_local4].limitLine = undefined;
}
}
}
}
function onOneVehicleStop(ce) {
var _local4;
var _local3 = 0;
while (_local3 < _vehicleCollection.length) {
if (_signalInfo && (ce.data.object == _vehicleCollection[_local3])) {
_local4 = getIndexfromSignalId(ce.data.object.signalId);
if (_local4 != -1) {
_newLimit[_local4] = ce.data.newLimit;
}
}
_local3++;
}
_local3 = 0;
while (_local3 < _vehicleCollection.length) {
if (_signalInfo && (ce.data.object == _vehicleCollection[_local3])) {
if ((direction == 0) || (direction == 3)) {
if (ce.data.newLimit > _newLimit[0]) {
_newLimit[0] = ce.data.newLimit;
crossSignalEventSender = Vehicle(ce.data.object);
}
} else if ((direction == 1) || (direction == 2)) {
if (ce.data.newLimit < _newLimit[0]) {
_newLimit[0] = ce.data.newLimit;
crossSignalEventSender = Vehicle(ce.data.object);
}
}
}
_local3++;
}
}
function get speed() {
return(_speed);
}
function set speed(value) {
_speed = value;
//return(speed);
}
function get vehicleCollection() {
return(_vehicleCollection);
}
function get signalInfo() {
return(_signalInfo);
}
function onOneVehicleStarted(ce) {
var _local5;
var _local2;
var _local3;
if (ce.data.object.signalId >= 0) {
_local5 = 0;
while (_local5 < _vehicleCollection.length) {
if (ce.data.object == _vehicleCollection[_local5]) {
if (_signalInfo) {
_local3 = getIndexfromSignalId(ce.data.object.signalId);
}
_local2 = 0;
while (_local2 < _vehicleCollection.length) {
if (((_signalInfo && (_vehicleCollection[_local2].road == ce.data.object.road)) && (_vehicleCollection[_local2].lane == ce.data.object.lane)) && (_vehicleCollection[_local2].signalId == ce.data.object.signalId)) {
if (_local3 != -1) {
_currentLimit[_local3] = _signalInfo[_local3].limit;
_newLimit[_local3] = _signalInfo[_local3].limit;
_vehicleCollection[_local2].limitLine = _signalInfo[_local3].limit;
}
}
_local2++;
}
break;
}
_local5++;
}
}
if (crossSignalEventSender && (crossSignalEventSender == ce.data.object)) {
if (_signalInfo) {
crossSignalEventSender = null;
_newLimit[0] = _signalInfo[0].limit;
}
}
}
function addToLane(vehicle) {
_vehicleCollection.push(vehicle);
if (_vehicleCollection.length == 1) {
_vehicleCollection[0].vehicleInFront = null;
} else {
_vehicleCollection[_vehicleCollection.length - 1].vehicleInFront = _vehicleCollection[_vehicleCollection.length - 2];
}
if (_signalInfo) {
vehicle.__set__signalId(_signalInfo[0].id);
vehicle.__set__limitLine(_newLimit[0]);
toFollowSignal++;
} else {
vehicle.__set__signalId(undefined);
vehicle.__set__limitLine(undefined);
}
vehicle.__set___crossSignalEventSender(crossSignalEventSender);
vehicle.__set__intersections(actualIntersection);
vehicle.__set__lane(0);
vehicle._rotation = direction * 90;
if (_signalInfo) {
vehicle.__set__signal(_signalInfo[0].state);
vehicle.setArt(true);
} else {
vehicle.__set__signal(false);
vehicle.setArt(false);
}
if (direction == GameConstants.UP) {
vehicle._x = lanes[0];
vehicle._y = Math.floor((Game.stageHeight + vehicle._height) + GameConstants.SPAWN_DISTANCE);
vehicle.__set__speed(-speed);
} else if (direction == GameConstants.DOWN) {
vehicle._x = lanes[0];
vehicle._y = Math.floor((-vehicle._height) - GameConstants.SPAWN_DISTANCE);
vehicle.__set__speed(speed);
} else if (direction == GameConstants.LEFT) {
vehicle._x = Math.floor((Game.stageWidth + vehicle._width) + GameConstants.SPAWN_DISTANCE);
vehicle._y = lanes[0];
vehicle.__set__speed(-speed);
} else if (direction == GameConstants.RIGHT) {
vehicle._x = Math.floor((-vehicle._width) - GameConstants.SPAWN_DISTANCE);
vehicle._y = lanes[0];
vehicle.__set__speed(speed);
}
vehicle._xscale = 85;
vehicle._yscale = 85;
vehicle.cacheAsBitmap = true;
vehicle.move(speed, vehicle.__get__limitLine());
}
function removeFromLane(vehicle) {
var _local2 = 0;
while (_local2 < _vehicleCollection.length) {
if (_vehicleCollection[_local2] == vehicle) {
_vehicleCollection.splice(_local2, 1);
break;
}
_local2++;
}
}
function clearRoad() {
var _local2;
CustomEventDispatcher.removeEventListener(CustomEvents.VEHICLE_STOPED, delegateOnOneVehicleStop);
CustomEventDispatcher.removeEventListener(CustomEvents.VEHICLE_STARTED, delegateOnOneVehicleStarted);
CustomEventDispatcher.removeEventListener(CustomEvents.PLEASE_CHANGE_MY_SIGNAL, delegateOnOneVehicleCrossSignal);
while (_vehicleCollection.length != 0) {
_vehicleCollection.pop();
}
_vehicleCollection = undefined;
if (!_signalInfo) {
return(undefined);
}
while (_signalInfo.length != 0) {
_signalInfo.pop();
}
_signalInfo = undefined;
}
function getIndexfromSignalId(id) {
var _local2 = 0;
_local2 = 0;
while (_local2 < _signalInfo.length) {
if (_signalInfo[_local2].id == id) {
return(_local2);
}
_local2++;
}
return(-1);
}
}
Symbol 936 MovieClip [__Packages.mx.transitions.easing.Bounce] Frame 0
class mx.transitions.easing.Bounce
{
function Bounce () {
}
static function easeOut(t, b, c, d) {
t = t / d;
if (t < 0.363636363636364) {
return((c * ((7.5625 * t) * t)) + b);
}
if (t < 0.727272727272727) {
t = t - 0.545454545454545;
return((c * (((7.5625 * t) * t) + 0.75)) + b);
}
if (t < 0.909090909090909) {
t = t - 0.818181818181818;
return((c * (((7.5625 * t) * t) + 0.9375)) + b);
}
t = t - 0.954545454545455;
return((c * (((7.5625 * t) * t) + 0.984375)) + b);
}
static function easeIn(t, b, c, d) {
return((c - easeOut(d - t, 0, c, d)) + b);
}
static function easeInOut(t, b, c, d) {
if (t < (d / 2)) {
return((easeIn(t * 2, 0, c, d) * 0.5) + b);
}
return(((easeOut((t * 2) - d, 0, c, d) * 0.5) + (c * 0.5)) + b);
}
static var version = "1.1.0.52";
}
Symbol 937 MovieClip [__Packages.mx.transitions.easing.Regular] Frame 0
class mx.transitions.easing.Regular
{
function Regular () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return(((c * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = t / d;
return((((-c) * t) * (t - 2)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((c / 2) * t) * t) + b);
}
t--;
return((((-c) / 2) * ((t * (t - 2)) - 1)) + b);
}
static var version = "1.1.0.52";
}
Symbol 938 MovieClip [__Packages.Signal] Frame 0
class Signal extends MovieClip
{
var _signalSound, _state, art, attachMovie, getNextHighestDepth, _id, onPress, _limit, _road;
function Signal () {
super();
_signalSound = new Sound();
_signalSound.attachSound("SignalSound");
}
function initialize(signalId, orientationInfo) {
_state = true;
art = attachMovie("SignalMC", "SignalMC" + signalId, getNextHighestDepth());
art._xscale = 50;
art._yscale = 50;
art.gotoAndStop(2);
if (orientationInfo) {
art._rotation = orientationInfo;
}
_id = signalId;
onPress = onSignalClick;
}
function onSignalClick() {
_state = !_state;
art.gotoAndStop(((art._currentframe - 1) ^ 1) + 1);
sendSwitchState();
if (!SoundFX.muteMusic) {
_signalSound.start(0, 1);
}
}
function removeClickEventListener() {
delete onPress;
}
function get id() {
return(_id);
}
function set id(value) {
_id = value;
//return(id);
}
function get limit() {
return(_limit);
}
function set limit(value) {
_limit = value;
//return(limit);
}
function get state() {
return(_state);
}
function set state(value) {
_state = value;
//return(state);
}
function sendSwitchState() {
var _local2 = new Object();
_local2.state = _state;
_local2.road = _road;
_local2.id = _id;
CustomEventDispatcher.dispatchEvent(new CustomEvents(CustomEvents.SIGNAL_CHANGED, _local2));
}
}
Symbol 939 MovieClip [__Packages.MuteButton] Frame 0
class MuteButton extends MovieClip
{
var state, onPress;
function MuteButton () {
super();
state = true;
onPress = changeState;
}
function changeState() {
state = !state;
}
}
Symbol 940 MovieClip [__Packages.Level3Lights] Frame 0
class Level3Lights extends MovieClip
{
function Level3Lights () {
super();
}
}
Symbol 859 MovieClip Frame 1
_root._trackClickThru(this);
Symbol 860 MovieClip Frame 1
var i = 1;
while (i <= 48) {
this["thumb" + i].gotoAndStop(i);
i++;
}
Symbol 860 MovieClip Frame 181
stop();
_parent.gotoAndStop("lblloader");
Symbol 869 Button
on (release) {
getURL ("http://www.gangofgamers.com", "_blank");
}
Symbol 872 MovieClip Frame 1
stop();
System.security.allowDomain("*");
var GameURL = _root._url;
if ((GameURL.indexOf(".gangofgamers.com") != -1) || (GameURL.indexOf(".games2win.com") != -1)) {
mc_common._visible = false;
} else {
mc_common._visible = true;
var str = ((((("http://s1.inviziads.com/lookup.html?type=strip&g=" + _root.obj_game._g2wGameId) + "&h=") + _root.obj_game._host) + "&hurl=") + _root._url);
loadMovie (str, this.loaderClip);
}
Symbol 882 MovieClip Frame 1
image_01.forceSmoothing = true;
Symbol 886 MovieClip Frame 1
image_02.forceSmoothing = true;
Symbol 890 MovieClip Frame 1
image_03.forceSmoothing = true;
Symbol 894 MovieClip Frame 1
image_04.forceSmoothing = true;
Symbol 901 MovieClip Frame 152
stop();
_parent._parent.gotoAndPlay("lblgame");