Frame 1
stop();
var leagueInfo = new LoadVars();
leagueInfo.onLoad = function (success) {
if (success) {
fiab_league_action = leagueInfo.fiab_league_action;
fiab_league_id = leagueInfo.fiab_league_id;
fiab_league_player = leagueInfo.fiab_league_player;
}
};
leagueInfo.load((("http://service.fishinabottle.com/hiscores2/disney_league_return.php?I=" + i) + "&query=") + query, leagueInfo, "GET");
Stage.showMenu = false;
_quality = "HIGH";
_focusrect = false;
var trackObj = new ViralTracker2(14, "http://stats.fishinabottle.com/scripts/stats2/get_viral_tracking.php", "");
_global.masterVolume = new Sound();
restoreVolume = _global.masterVolume.getVolume();
var soundOn = true;
var percLoaded = 0;
loader.loadBar._xscale = 0;
onEnterFrame = function () {
if (getBytesTotal() > 0) {
percLoaded = percLoaded - ((percLoaded - ((getBytesLoaded() / getBytesTotal()) * 100)) * 0.2);
loader.loadBar._xscale = 1 + percLoaded;
if (percLoaded > 99) {
onEnterFrame = null;
trackObj.beginTracking(getBytesTotal());
gotoAndPlay ("loaded");
}
}
};
Frame 13
var myAddress;
var tempArray;
var failures = 0;
var replay = false;
hiScoresInst._visible = false;
hiScoresInst.onConfigure = function () {
gotoAndStop ("title");
};
hiScoresInst.onConfigureFail = function () {
failures++;
allowScores = false;
if (failures > 5) {
gotoAndStop ("title");
}
};
hiScoresInst.configure("http://service.fishinabottle.com/hiscores2/hiscores_general_disney.php", 8, this, 16711680);
hiScoresInst.onHide = function () {
gotoAndStop ("title");
};
sfxClick = new Sound(this.createEmptyMovieClip("sfx1", 5001));
sfxClick.attachSound("click.wav");
sfxMainLoop = new Sound(this.createEmptyMovieClip("sfx2", 5002));
sfxMainLoop.attachSound("titleloop.wav");
_global.mute = function (enable) {
SFXUIClick.start();
if (enable) {
_global.masterVolume.setVolume(0);
soundOn = false;
} else {
_global.masterVolume.setVolume(restoreVolume);
soundOn = true;
}
};
Frame 14
if (replay) {
reveal.caption._visible = false;
}
Frame 20
stop();
replay = true;
var pressQuit = false;
var pressScores = false;
playGame.onRelease = function () {
trackObj.continueTracking("PL");
gotoAndPlay ("game");
sfxClick.start();
};
sendToFriend.onRelease = function () {
gotoAndPlay ("send");
sfxClick.start();
};
moreGames.onRelease = function () {
getURL ("http://www.disney.co.uk/DisneyChannel/supersites/phineasandferb", "_blank");
sfxClick.start();
};
viewScores.onRelease = function () {
pressScores = true;
gotoAndPlay ("scores");
sfxClick.start();
};
logoButton.onRelease = function () {
getURL ("http://www.disney.co.uk/DisneyChannel", "_blank");
trackObj.continueTracking("CT");
};
sfxMainLoop.stop();
sfxMainLoop.setVolume(100);
sfxMainLoop.start(0, 99999);
Frame 31
stop();
back.onRelease = function () {
gotoAndPlay ("options");
sfxClick.start();
};
Frame 42
stop();
if (pressScores) {
pressScores = false;
hiScoresInst.justView();
}
back.onRelease = function () {
hiScoresInst._visible = false;
gotoAndPlay ("options");
sfxClick.start();
};
Frame 61
function setRaceScore(s) {
score = s;
}
stop();
sfxMainLoop.setVolume(50);
var score = 0;
quit.onRelease = function () {
pressQuit = true;
sfxClick.start();
play();
};
Frame 66
function submit() {
gotoAndPlay ("scores");
sfxClick.start();
}
function cancel() {
gotoAndPlay ("options");
sfxClick.start();
}
if (!pressQuit) {
hiScoresInst.submit(score, submit, cancel);
}
Frame 70
if (!pressQuit) {
stop();
} else {
gotoAndPlay ("options");
}
Symbol 4 MovieClip [particleSystem] Frame 1
#initclip 10
Object.registerClass("particleSystem", ParticleSystem);
#endinitclip
Symbol 41 MovieClip Frame 1
_visible = false;
Symbol 42 MovieClip [car] Frame 1
#initclip 9
Object.registerClass("car", PlayerVehicle);
#endinitclip
Symbol 47 Button
on (release) {
_global.mute(true);
gotoAndStop ("mute");
}
Symbol 49 Button
on (release) {
_global.mute(false);
gotoAndStop ("unmute");
}
Symbol 50 MovieClip [soundButtonMov] Frame 1
stop();
Symbol 50 MovieClip [soundButtonMov] Frame 11
stop();
Symbol 57 MovieClip Frame 1
var today_date = new Date();
this.gotoAndStop("premier");
var month = (today_date.getMonth() + 1);
var year = (today_date.getFullYear() + 1);
if ((month > 1) && (year > 2007)) {
this.gotoAndStop("after");
}
Symbol 1040 MovieClip [__Packages.ViralTracker2] Frame 0
class ViralTracker2
{
var dat, trackerAddress, referer, first_ping, second_ping;
function ViralTracker2 (viralID, address, referer) {
var _local3 = new Date();
var _local2 = new LoadVars();
dat = new LoadVars();
dat.fiab_viral_id = viralID;
_local2.fiab_initial_ping = "true";
_local2.fiab_viral_id = viralID;
trackerAddress = address;
this.referer = referer;
first_ping = _local3.getTime();
sendVars(_local2);
}
function continueTracking(activity) {
var _local2;
dat.fiab_action = activity;
sendVars(dat);
delete dat.fiab_action;
}
function beginTracking(appSize) {
dat.fiab_start_tracking = "true";
var _local4;
var _local3 = new Date();
second_ping = _local3.getTime();
_local4 = (second_ping - first_ping) / 1000;
appSize = appSize / 1024;
dat.dl_speed = Math.round(appSize / _local4);
if (dat.dl_speed == Infinity) {
dat.dl_speed = 0;
}
dat.language = System.capabilities.language;
dat.os = System.capabilities.os;
dat.screenx = System.capabilities.screenResolutionX;
dat.screeny = System.capabilities.screenResolutionY;
dat.player = getVersion();
if (Camera.get() == null) {
dat.camera = 0;
} else {
dat.camera = 1;
}
if (Microphone.get() == null) {
dat.mic = 0;
} else {
dat.mic = 1;
}
dat.fiab_referer = referer;
var _local2 = _url;
if (_local2.substr(0, 5) == "file:") {
dat.fiab_host = "LOCAL";
} else if (_local2.substr(0, 7) == "http://") {
dat.fiab_host = _local2.substr(7, _local2.indexOf("/", 7) - 7);
} else if (_local2.substr(0, 8) == "https://") {
dat.fiab_host = _local2.substr(8, _local2.indexOf("/", 8) - 8);
} else {
dat.fiab_host = _url;
}
sendVars(dat);
delete dat.language;
delete dat.os;
delete dat.screenx;
delete dat.screeny;
delete dat.player;
delete dat.fiab_start_tracking;
delete dat.camera;
delete dat.mic;
delete dat.fiab_referer;
delete dat.fiab_host;
delete dat.dl_speed;
}
function trackFrameRate(frameRate) {
dat.framerate = frameRate;
sendVars(dat);
delete dat.framerate;
}
function sendVars(senderObj) {
trace("SENDING VARS: ");
var _local2;
var _local4 = new Date();
for (_local2 in senderObj) {
trace((_local2 + " : ") + senderObj[_local2]);
}
senderObj.rnd = _local4.getTime();
trace(trackerAddress);
senderObj.sendAndLoad(trackerAddress, senderObj, "GET");
trace(newline);
delete senderObj.rnd;
}
}
Symbol 1041 MovieClip [__Packages.PlayerVehicle] Frame 0
class PlayerVehicle extends MovieClip
{
var isRacing, speed, keyAccel, keyRev, keyLeft, keyRight, keyBoost, lastPos, velocity, skid, movement, friction, grip, accel, maxSpeed, boostPower, boostTime, currBoost, boostCount, boostCharge, boostClip, skidTime, isSkidding, currWaypoint, playerId, playerName, _name, currLap, lapTimes, isAccel, _x, _y, _rotation, nextLapMarker, lapCounter, raceTimer, boostBar, skidmarks, gripRating, accelRating, maxSpeedRating, clip, _parent, sfxBoost, skidSounds, sfxMax, sfxMin, sfxIdle, sfxFull, sfxInc, sfxDec;
function PlayerVehicle () {
super();
isRacing = false;
speed = 0;
keyAccel = 38;
keyRev = 40;
keyLeft = 37;
keyRight = 39;
keyBoost = 32;
lastPos = new Vector2D();
velocity = new Vector2D(0, 0);
skid = new Vector2D(0, 0);
movement = new Vector2D(0, 0);
friction = 0.95;
grip = 0.125;
accel = 0.25;
maxSpeed = 5;
boostPower = 2;
boostTime = 50;
currBoost = 1;
boostCount = 0;
boostCharge = 0;
boostClip.stop();
skidTime = 0;
isSkidding = false;
currWaypoint = 0;
playerId = 0;
playerName = _name;
currLap = 0;
lapTimes = new Array();
isAccel = false;
}
function setPosition(px, py, rot) {
_x = px;
_y = py;
if (rot != undefined) {
_rotation = rot;
}
lastPos.x = px;
lastPos.y = py;
}
function setPlayer(player) {
playerId = player;
}
function setName(player) {
playerName = player;
}
function resetLaps() {
currLap = 0;
}
function setNextLapMarker(marker) {
nextLapMarker = marker;
}
function setLapCounter(counter) {
lapCounter = counter;
}
function setTimer(race) {
raceTimer = race;
}
function addLapTime(t) {
lapTimes.push(t);
}
function setBoostBar(bar) {
boostBar = bar;
boostBar._xscale = 0;
}
function setSkidmarks(clip) {
skidmarks = clip;
skidmarks.stop();
}
function setGrip(g) {
gripRating = g;
grip = 1 - (gripRating * 0.5);
}
function setAccel(a) {
accelRating = a;
accel = accelRating * 0.5;
}
function setMaxSpeed(max) {
maxSpeedRating = max;
maxSpeed = maxSpeedRating * 8;
}
function setBoost(pow, t) {
boostPower = pow;
boostTime = t;
}
function setCustomCar(settings) {
clip.chasis.gotoAndStop(settings[1]);
clip.bodyKit.gotoAndStop(settings[3]);
clip.decals.gotoAndStop(settings[4]);
}
function update() {
if (!isRacing) {
return(undefined);
}
if (playerId == 0) {
} else {
getKeyPresses();
}
speed = speed * friction;
skid.x = skid.x * grip;
skid.y = skid.y * grip;
if (Math.abs(speed) > maxSpeed) {
speed = maxSpeed;
} else if (speed < (-0.5 * maxSpeed)) {
speed = -0.5 * maxSpeed;
}
if (Math.abs(speed) < 0.1) {
speed = 0;
}
velocity.x = Math.sin(_rotation * PI_OVER_180) * speed;
velocity.y = Math.cos(_rotation * PI_OVER_180) * (-speed);
getMovementVector();
lastPos.x = _x;
lastPos.y = _y;
_x = _x + movement.x;
_y = _y + movement.y;
if (currBoost > 1) {
boostCount++;
if (boostCount > boostTime) {
currBoost = 1;
boostCount = 0;
boostClip.gotoAndStop("off");
maxSpeed = maxSpeedRating * 8;
boostCharge = 0;
boostBar._xscale = 0;
}
if (!Key.isDown(keyAccel)) {
accelerate();
}
} else if (boostCharge < 1) {
boostCharge = boostCharge + 0.005;
boostBar._xscale = boostCharge * 100;
}
}
function accelerate() {
speed = speed + (accel * currBoost);
skid.x = skid.x + ((speed / 10) * Math.cos(((Math.PI*2) * (_rotation - 90)) / 360));
skid.y = skid.y + ((speed / 10) * Math.sin(((Math.PI*2) * (_rotation - 90)) / 360));
}
function reverse() {
speed = speed - (accel * 0.5);
}
function turnRight() {
if ((speed > 5) && (gripRating < 0.5)) {
_parent._parent.startSkid();
}
if ((speed < 3.5) && (speed >= 0)) {
_rotation = _rotation + speed;
} else if (speed < 0) {
_rotation = _rotation + Math.min(3.5, (-speed) / 2);
} else {
_rotation = _rotation + 3.5;
}
speed = speed * 0.99;
}
function turnLeft() {
if ((speed > 5) && (gripRating < 0.5)) {
_parent._parent.startSkid();
}
if ((speed < 3.5) && (speed >= 0)) {
_rotation = _rotation - speed;
} else if (speed < 0) {
_rotation = _rotation - Math.min(3.5, (-speed) / 2);
} else {
_rotation = _rotation - 3.5;
}
speed = speed * 0.99;
}
function brake() {
if (speed > 3) {
startSkid();
}
speed = speed - (speed * 0.05);
}
function boost() {
if (currBoost < boostPower) {
if (boostCharge >= 1) {
currBoost = boostPower;
boostCount = 0;
boostClip.gotoAndStop("on");
sfxBoost.start();
maxSpeed = 5;
}
}
}
function startSkid() {
if (!isSkidding) {
var _local2 = Math.floor(Math.random() * skidSounds.length);
skidSounds[_local2].start();
}
skidTime = 0;
isSkidding = true;
}
function endSkid() {
skidTime = 0;
isSkidding = false;
}
function getKeyPresses() {
if (Key.isDown(keyAccel)) {
if (!Key.isDown(keyRev)) {
accelerate();
if (!isAccel) {
isAccel = true;
soundInc();
}
}
} else if (Key.isDown(keyRev)) {
if (speed > 0) {
brake();
} else {
reverse();
}
isAccel = false;
soundDec();
} else {
isAccel = false;
soundDec();
}
if (Key.isDown(keyRight)) {
turnRight();
} else if (Key.isDown(keyLeft)) {
turnLeft();
}
if (Key.isDown(keyBoost)) {
boost();
}
}
function setControlKeys(acc, rev, l, r, boo) {
keyAccel = acc;
keyRev = rev;
keyLeft = l;
keyRight = r;
keyBoost = boo;
}
function setVehicleSounds(idle, full, inc, dec, boost) {
sfxMax = false;
sfxMin = true;
sfxIdle = idle;
sfxFull = full;
sfxInc = inc;
sfxDec = dec;
sfxBoost = boost;
soundIdle();
}
function setSkidSounds(sounds) {
skidSounds = new Array();
var _local2 = 0;
while (_local2 < sounds.length) {
skidSounds[_local2] = sounds[_local2];
_local2++;
}
}
function soundIdle() {
sfxIdle.start(0, 99999);
}
function soundFull() {
sfxFull.start(0, 99999);
}
function soundInc() {
if (!sfxMax) {
sfxIdle.stop();
sfxFull.stop();
sfxDec.stop();
sfxInc.start(0, 1);
sfxMax = true;
sfxMin = false;
}
}
function soundDec() {
if (!sfxMin) {
sfxIdle.stop();
sfxFull.stop();
sfxInc.stop();
sfxDec.start(0, 1);
sfxMin = true;
sfxMax = false;
}
}
function soundStopAll() {
sfxIdle.stop();
sfxFull.stop();
sfxInc.stop();
sfxDec.stop();
}
function getMovementVector() {
var _local2 = velocity.getMagnitude();
movement.x = velocity.x + skid.x;
movement.y = velocity.y + skid.y;
movement.normalise();
movement.scaleVector(_local2);
var _local3 = movement.cross(velocity);
if (Math.abs(_local3) > 2.5) {
startSkid();
}
}
function debug() {
_parent.debugClip.clear();
_parent.debugClip.lineStyle(3, 255, 100);
_parent.debugClip.moveTo(_x, _y);
_parent.debugClip.lineTo(_x + (skid.x * 5), _y + (skid.y * 5));
_parent.debugClip.lineStyle(3, 16711680, 100);
_parent.debugClip.moveTo(_x, _y);
_parent.debugClip.lineTo(_x + (velocity.x * 5), _y + (velocity.y * 5));
_parent.debugClip.lineStyle(3, 16711935, 100);
_parent.debugClip.moveTo(_x, _y);
_parent.debugClip.lineTo(_x + (movement.x * 5), _y + (movement.y * 5));
}
var PI_OVER_180 = (Math.PI/180);
}
Symbol 1042 MovieClip [__Packages.Vector2D] Frame 0
class Vector2D
{
var x, y;
function Vector2D (vx, vy) {
x = vx;
y = vy;
}
function addVector(v) {
x = x + v.x;
y = y + v.y;
}
function scaleVector(s) {
x = x * s;
y = y * s;
}
function getMagnitude() {
return(Math.sqrt((x * x) + (y * y)));
}
function normalise() {
var _local2 = getMagnitude();
x = x / _local2;
y = y / _local2;
}
function dot(v) {
var _local2 = (x * v.x) + (y * v.y);
return(_local2);
}
function cross(v) {
var _local2 = (x * v.y) - (y * v.x);
return(_local2);
}
function angle() {
var _local3 = Math.atan2(-y, -x);
var _local2 = Math.round(_local3 * D180_OVER_PI);
_local2 = _local2 - 90;
if (_local2 > 360) {
_local2 = _local2 - 360;
}
if (_local2 <= 0) {
_local2 = 360 + _local2;
}
return(_local2);
}
function vector(a) {
x = Math.sin(a * PI_OVER_D180);
y = -Math.cos(a * PI_OVER_D180);
}
var D180_OVER_PI = 57.2957795130823;
var PI_OVER_D180 = (Math.PI/180);
}
Symbol 1043 MovieClip [__Packages.ParticleSystem] Frame 0
class ParticleSystem extends MovieClip
{
var _visible, running, paused, particles, numParticles, lifespan, rotation, scaling, xSpeed, ySpeed, xSpeedRandom, ySpeedRandom, lifeRandom, rotateRandom, xPos, _x, yPos, _y, gravity, orientToPath, orientToSource, alphaFlag, alphaEasing, spawnInterval, spawnNext, spawnWidth, spawnHeight, frameOffset, holder, _parent, getDepth, _rotation;
function ParticleSystem () {
super();
_visible = false;
running = false;
paused = false;
particles = new Array();
numParticles = 20;
lifespan = 10;
rotation = 0;
scaling = 1;
xSpeed = 0;
ySpeed = 0;
xSpeedRandom = 0;
ySpeedRandom = 0;
lifeRandom = 0;
rotateRandom = 0;
xPos = _x;
yPos = _y;
gravity = 0;
orientToPath = false;
orientToSource = false;
alphaFlag = true;
alphaEasing = 0;
spawnInterval = 0;
spawnNext = 0;
spawnWidth = 0;
spawnHeight = 0;
frameOffset = 0;
}
function start() {
running = true;
var _local2 = 0;
while (_local2 < frameOffset) {
update();
_local2++;
}
}
function stop() {
running = false;
}
function pause() {
paused = true;
}
function resume() {
paused = true;
}
function burst() {
if (!paused) {
var _local2 = 0;
while (_local2 < numParticles) {
addParticle(randSpeed(xSpeed, xSpeedRandom), randSpeed(ySpeed, ySpeedRandom), randLife(lifespan));
_local2++;
}
}
}
function init(clip, num, life, dx, dy, holder) {
if ((holder == undefined) || (holder == null)) {
this.holder = _parent.createEmptyMovieClip("holder", getDepth() + 1);
} else {
this.holder = holder;
}
numParticles = num;
lifespan = life;
xSpeed = dx;
ySpeed = dy;
var _local2 = 0;
while (_local2 < numParticles) {
particles.push(this.holder.attachMovie(clip, "p" + _local2, _local2));
var _local3 = particles[_local2];
_local3._x = 0;
_local3._y = 0;
_local3._visible = false;
_local3.life = 100;
_local2++;
}
}
function setScaling(scale) {
scaling = scale;
}
function setRotation(rotate) {
rotation = rotate;
}
function setLifeRandomness(rand) {
lifeRandom = rand;
}
function setSpeedRandomness(x, y) {
xSpeedRandom = x;
ySpeedRandom = y;
}
function setRotationRandomness(rand) {
rotateRandom = rand;
}
function setGravity(gravity) {
this.gravity = gravity;
}
function setAlpha(alpha) {
alphaFlag = alpha;
}
function setAlphaEasing(ease) {
if (ease > 1) {
ease = 1;
} else if (ease < 0) {
ease = 0;
}
alphaEasing = ease;
}
function setOrientToPath(orient) {
orientToPath = orient;
}
function setOrientToSource(orient) {
orientToSource = orient;
}
function setSpawnArea(x, y) {
spawnWidth = x;
spawnHeight = y;
}
function setSpawnInterval(interval) {
spawnInterval = interval;
}
function setFrameOffset(offset) {
frameOffset = offset;
}
function addParticle(dx, dy, life) {
var _local3 = 0;
while (_local3 < numParticles) {
var _local2 = particles[_local3];
if (!_local2._visible) {
break;
}
_local3++;
}
if (spawnWidth != 0) {
_local2._x = xPos + ((Math.random() * spawnWidth) - (spawnWidth * 0.5));
} else {
_local2._x = xPos;
}
if (spawnHeight != 0) {
_local2._y = yPos + ((Math.random() * spawnHeight) - (spawnHeight * 0.5));
} else {
_local2._y = yPos;
}
_local2._rotation = 0;
_local2._xscale = 100;
_local2._yscale = 100;
_local2._alpha = 100;
_local2.maxLife = life;
_local2.life = life;
_local2.fade = 100 / life;
_local2.dx = dx;
_local2.dy = dy;
_local2.rot = randRotation(rotation);
_local2.scale = scaling;
if (orientToSource) {
_local2._rotation = _rotation - 90;
}
_local2._visible = true;
}
function randSpeed(speed, rand) {
var _local2 = (((speed + 1) * rand) * Math.random()) - (((speed + 1) * rand) * 0.5);
speed = speed + _local2;
return(speed);
}
function randLife(life) {
var _local3 = ((life + 1) * lifeRandom) * Math.random();
life = life - _local3;
return(life);
}
function randRotation(rot) {
var _local3 = (((rot + 1) * rotateRandom) * Math.random()) - (((rot + 1) * rotateRandom) * 0.5);
rot = rot + _local3;
return(rot);
}
function update() {
if (running) {
if (spawnNext >= spawnInterval) {
addParticle(randSpeed(xSpeed, xSpeedRandom), randSpeed(ySpeed, ySpeedRandom), randLife(lifespan));
spawnNext = 0;
}
spawnNext++;
}
xPos = _x;
yPos = _y;
var _local3 = 0;
while (_local3 < numParticles) {
var _local2 = particles[_local3];
if (_local2._visible) {
_local2.life--;
if (_local2.life <= 0) {
_local2._visible = false;
} else {
if (alphaFlag) {
if ((_local2.life / _local2.maxLife) < (1 - alphaEasing)) {
_local2._alpha = _local2._alpha - (_local2.fade / (1 - alphaEasing));
}
}
if (orientToPath) {
_local2._rotation = (Math.atan2(_local2.dy, _local2.dx) * D180_OVER_PI) - 270;
} else {
_local2._rotation = _local2._rotation + _local2.rot;
}
_local2.dy = _local2.dy + gravity;
_local2._x = _local2._x + _local2.dx;
_local2._y = _local2._y + _local2.dy;
_local2._xscale = _local2._xscale * _local2.scale;
_local2._yscale = _local2._yscale * _local2.scale;
}
}
_local3++;
}
}
function cleanUp() {
var _local2 = 0;
while (_local2 < numParticles) {
particles[_local2].removeMovieClip();
_local2++;
}
delete particles;
}
function reset() {
var _local2 = 0;
while (_local2 < numParticles) {
particles[_local2]._visible = false;
_local2++;
}
}
function onEnterFrame() {
if (!paused) {
update();
}
}
var D180_OVER_PI = 57.2957795;
}
Symbol 1044 MovieClip [__Packages.HighScores2] Frame 0
class HighScores2 extends MovieClip
{
var theTitle, attemptCounter, configured, canConnect, score_runner, onEnterFrame, activityList, _visible, confirm, countryCodeArray, leagueNamesSoFar, leagueNameHolder, currentSpan, allMovie, monthMovie, weekMovie, todayMovie, leagueMovie, allButton, monthButton, weekButton, todayButton, leagueButton, leagueNameString, currentActivity, theRoot, serviceURL, viralID, highLightColor, quitButton, league, league_player, score_id, currentFirstPos, scoresPerPage, scoresAsTime, previousButton, nextButton, leaguesOn, leaveLeagueButton, startLeagueButton, debugArea, theScore, onSubmit, onCancel, gotoAndStop, theScoreBox, player_name, nameInput, submitButton, skipitButton, leagueStarterName, leagueStarterEmail, submitLeagueButton, addMoreButton, leagueName, viralName, loadingMovie, onHide;
function HighScores2 () {
super();
theTitle.text = "HIGH SCORES TABLE";
attemptCounter = new Number(0);
configured = new Boolean(false);
canConnect = new Boolean(true);
score_runner = new LoadVars();
onEnterFrame = loadLoop;
activityList = new Array();
_visible = false;
confirm._visible = false;
countryCodeArray = new Array("AF", "AL", "DZ", "AS", "AD", "AO", "AI", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "AX", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BA", "BW", "BR", "IO", "BN", "BG", "BF", "BI", "KH", "CM", "CA", "KY", "CF", "CL", "CN", "CO", "CD", "CK", "CR", "HR", "CU", "CY", "CZ", "DK", "DJ", "DO", "EC", "EG", "SV", "ER", "EE", "ET", "EU", "FO", "FJ", "FI", "FR", "GF", "PF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GW", "GY", "HT", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IL", "IT", "JM", "JP", "JO", "KZ", "KE", "KI", "KR", "KW", "KG", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MK", "MG", "MW", "MY", "MV", "ML", "MT", "MR", "MU", "MX", "FM", "MD", "MC", "MN", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "AN", "NC", "NZ", "NI", "NE", "NG", "NU", "AP", "NF", "MP", "NO", "OM", "PK", "PW", "PS", "PA", "PG", "PY", "PE", "PH", "PL", "PT", "PR", "QA", "ZZ", "RO", "RU", "RW", "KN", "LC", "WS", "SM", "SA", "SN", "RS", "CS", "SC", "SL", "SG", "SK", "SI", "SB", "ZA", "ES", "LK", "SD", "SR", "SZ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TG", "TO", "TT", "TN", "TR", "TM", "TV", "UG", "UA", "AE", "GB", "US", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "YE", "ZM", "ZW", "00");
leagueNamesSoFar = new Number();
leagueNameHolder = new Object();
}
function showSpan() {
var _local2;
var _local5 = new Array("ALL", "MONTH", "WEEK", "DAY", "LEAGUE");
var _local4 = returnArrayIndex(currentSpan, _local5);
var _local3 = new Array(allMovie, monthMovie, weekMovie, todayMovie, leagueMovie);
trace("DEACTIVEATEING BUTTONS");
_local2 = 0;
while (_local2 < _local3.length) {
trace(_local3[_local2]);
_local3[_local2].gotoAndStop("dormant");
_local2++;
}
trace(_local4);
_local3[_local4].gotoAndStop("active");
allButton = allMovie.allButton;
monthButton = monthMovie.monthButton;
weekButton = weekMovie.weekButton;
todayButton = todayMovie.todayButton;
leagueButton = leagueMovie.leagueButton;
if (currentSpan == "LEAGUE") {
if ((leagueNameString == undefined) || (leagueNameString == "")) {
theTitle.text = "YOUR LEAGUE HIGH SCORES";
} else {
theTitle.text = leagueNameString.toUpperCase();
}
} else {
theTitle.text = "HIGH SCORE TABLE";
}
}
function configure(theHost, theID, theRoot, highLight) {
if (canConnect == false) {
activityList.push(Array("CONFIGURE", theHost, theID, theRoot, highLight));
return(undefined);
}
currentActivity = Array("CONFIGURE", theHost, theID, theRoot, highLight);
canConnect = false;
var _local4 = new Date();
var self = this;
this.theRoot = theRoot;
checkForLeagues();
serviceURL = theHost;
viralID = theID;
if (highLight == undefined) {
highLightColor = 16711680 /* 0xFF0000 */;
} else {
highLightColor = highLight;
}
quitButton.onRelease = function () {
self.hideScores();
self.onHide();
};
score_runner.fiab_viral_id = viralID;
score_runner.rnd = _local4.getTime();
score_runner.fiab_score_action = "CONFIGURE";
score_runner.league_id = league;
score_runner.fiab_league_player = league_player;
score_runner.onLoad = function (success) {
self.loadingMovie._visible = false;
if (success) {
trace("CONFIGURED SUCCESS");
if (this.errmsg != undefined) {
self.handleError(this.errmsg);
} else {
if (this.fiab_league_player == 0) {
self.league_player = 0;
}
if (this.league_id == 0) {
self.league_id = 0;
}
self.leagueNameString = this.league_name;
self.attemptCounter = 0;
if (this.leaguesOn == "true") {
self.leaguesOn = true;
} else {
self.leaguesOn = false;
}
if (this.global_scores == "true") {
self.globalScoresOn = true;
} else {
self.globalScoresOn = false;
}
if (this.scoresAsTime == "false") {
self.scoresAsTime = false;
} else {
self.scoresAsTime = true;
}
self.maxScore = Number(this.max_score);
self.minScore = Number(this.min_score);
self.scoresPerPage = Number(this.scoresPerPage);
self.viralName = this.game_name;
self.defaultSpan = this.default_span;
self.currentSpan = this.default_span;
if (((((self.league != 0) && (self.league != undefined)) && (self.league_player != 0)) && (self.league_player != undefined)) && (self.leaguesOn == true)) {
self.currentSpan = "LEAGUE";
}
if (this.player_name != undefined) {
self.player_name = this.player_name;
}
self.configured = true;
self.onConfigure();
}
} else {
trace("ERROR CONFIGURING " + self.attemptCounter);
self.handleError("FAILED");
self.onConfigureFail();
}
self.canConnect = true;
delete this.rnd;
delete this.fiab_score_action;
delete this.errmsg;
delete this.default_span;
delete this.leaguesOn;
delete this.global_scores;
delete this.max_score;
delete this.min_score;
delete this.game_name;
delete this.scoresAsTime;
delete this.scoresPerPage;
delete this.league_id;
delete this.fiab_league_player;
delete this.player_name;
delete this.league_name;
};
score_runner.sendAndLoad(serviceURL, score_runner, "GET");
}
function loadLoop() {
if (canConnect == false) {
return(undefined);
}
if (activityList.length < 1) {
return(undefined);
}
currentActivity = activityList.shift();
trace("ACTIVITY : " + currentActivity);
switch (currentActivity[0]) {
case "RANK" :
returnRank(currentActivity[1]);
break;
case "SUBMIT" :
submitScore(currentActivity[1], currentActivity[2], currentActivity[3], currentActivity[4]);
break;
case "CONFIGURE" :
configure(currentActivity[1], currentActivity[2], currentActivity[3], currentActivity[4]);
break;
case "GET SCORES" :
get_scores();
break;
case "START_LEAGUE" :
submitLeagueStart();
break;
case "LEAVE_LEAGUE" :
leaveForEver();
}
}
function submitScore(myName, myScore, onSuccess, isGlobal) {
if (canConnect == false) {
activityList.push(Array("SUBMIT", myName, myScore, onSuccess, isGlobal));
return(undefined);
}
currentActivity = Array("SUBMIT", myName, myScore, onSuccess, isGlobal);
canConnect = false;
trace("SUBMITING SCORE : " + serviceURL);
var _local6;
var _local2 = new Date();
var self = this;
score_runner.scorerName = myName;
score_runner.score = myScore;
score_runner.score_id = score_id;
score_runner.fiab_score_action = "SUBMIT";
score_runner.league_id = league;
score_runner.league_player = league_player;
score_runner.rnd = _local2.getTime();
score_runner.globalScore = isGlobal;
score_runner.onLoad = function (success) {
self.loadingMovie._visible = false;
if (success) {
trace("SUBMIT SUCCESS");
onSuccess();
if (this.errmsg == undefined) {
self.attemptCounter = 0;
if (this.globalScore == 0) {
trace("WAS NOT A GLOBAL SCORE");
self.gotoAndStop("submited");
self.populateSubmited();
} else {
trace("WAS A GLOBAL SCORE");
self.score_id = this.score_id;
}
self.player_name = this.player_name;
} else if (this.errmsg != undefined) {
self.handleError(this.errmsg);
}
} else {
trace("SUBMIT ERROR" + self.attemptCounter);
self.handleError("FAILED");
}
delete this.scorerName;
delete this.score;
delete this.rnd;
delete this.fiab_score_action;
delete this.errmsg;
delete this.league_id;
delete this.league_player;
delete this.globalScore;
delete this.more_available;
delete this.currentSpan;
delete this.score_id;
delete this.globalScore;
delete this.player_name;
self.canConnect = true;
};
score_runner.sendAndLoad(serviceURL, score_runner, "GET");
if (score_runner.globalScore == 0) {
doLoading();
}
}
function populateSubmited() {
var _local2;
var self = this;
var _local3;
currentFirstPos = Number(score_runner.first_pos);
confirm._visible = false;
showSpan();
_local2 = 0;
while (_local2 < scoresPerPage) {
if (((score_runner["score" + _local2] == "NONE") && (score_runner["name" + _local2] == "NONE")) && ((score_runner["location" + _local2] = "NONE"))) {
this["score" + _local2]._visible = false;
this["flag" + _local2]._visible = false;
this["name" + _local2]._visible = false;
this["rank" + _local2]._visible = false;
} else {
this["score" + _local2]._visible = true;
this["flag" + _local2]._visible = true;
this["name" + _local2]._visible = true;
this["rank" + _local2]._visible = true;
this["score" + _local2].text = score_runner["score" + _local2];
if (scoresAsTime == true) {
this["score" + _local2].text = secondsToString(Number(this["score" + _local2].text));
} else {
this["score" + _local2].text = addCommas(this["score" + _local2].text);
}
upDateFlag(this["flag" + _local2], score_runner["location" + _local2]);
this["name" + _local2].text = score_runner["name" + _local2];
this["rank" + _local2].text = Number(Number(score_runner.first_pos) + Number(_local2));
if (score_runner["highlight" + _local2] == "YES") {
trace("WE HAVE SCORE");
_local3 = new TextFormat();
_local3.color = highLightColor;
this["score" + _local2].setTextFormat(_local3);
this["name" + _local2].setTextFormat(_local3);
this["rank" + _local2].setTextFormat(_local3);
}
}
_local2++;
}
if (score_runner.first_pos > 1) {
previousButton._visible = true;
previousButton.onRelease = function () {
trace("PREVIOUS PRESSED");
self.currentFirstPos = self.currentFirstPos - self.scoresPerPage;
self.get_scores();
};
} else {
previousButton._visible = false;
previousButton.onRelease = null;
}
trace("MORE SCORES : " + score_runner.more_available);
trace("SPAN : " + score_runner.currentSpan);
currentSpan = score_runner.currentSpan;
if (score_runner.more_available == "true") {
nextButton._visible = true;
nextButton.onRelease = function () {
trace("NEXT PRESSED");
self.currentFirstPos = self.currentFirstPos + self.scoresPerPage;
self.get_scores();
};
} else {
nextButton._visible = false;
nextButton.onRelease = null;
}
if (((leaguesOn == true) && (league != 0)) && (league != undefined)) {
trace("LEAGUES ARE ON");
leaveLeagueButton._visible = true;
leaveLeagueButton.onRelease = function () {
trace("LEAVE LEAGUE");
self.setupLeaveLeague();
};
} else {
trace("LEAGUES AE OFF");
leaveLeagueButton._visible = false;
leaveLeagueButton.onRelease = null;
}
if ((leaguesOn == true) && (league == 0)) {
startLeagueButton._visible = true;
startLeagueButton.onRelease = function () {
trace("START A LEAGUE");
self.gotoAndStop("start_league");
self.setupLeagueStartPage();
};
} else {
startLeagueButton._visible = false;
startLeagueButton.onRelease = null;
}
if ((leaguesOn == true) && (league != 0)) {
leagueButton._visible = true;
trace("SHOW LEAGUE BUTTON");
leagueButton.onRelease = function () {
trace("VIEW LEAGUE");
self.currentSpan = "LEAGUE";
self.currentFirstPos = 0;
self.get_scores();
};
} else {
trace("HIDE LEAGE BUTTON");
leagueButton._visible = false;
leagueButton.onRelease = null;
}
allButton.onRelease = function () {
trace("VIEW ALL SCORES");
self.currentSpan = "ALL";
self.currentFirstPos = 0;
self.get_scores();
};
monthButton.onRelease = function () {
trace("VIEW MONTHS SCORES");
self.currentSpan = "MONTH";
self.currentFirstPos = 0;
self.get_scores();
};
weekButton.onRelease = function () {
trace("VIEW WEEKS SCORES");
self.currentSpan = "WEEK";
self.currentFirstPos = 0;
self.get_scores();
};
todayButton.onRelease = function () {
trace("VIEW DAYS SCORES");
self.currentSpan = "DAY";
self.currentFirstPos = 0;
self.get_scores();
};
_local2 = 0;
while (_local2 < 10) {
delete score_runner["score" + _local2];
delete score_runner["location" + _local2];
delete score_runner["name" + _local2];
delete score_runner["highlight" + _local2];
_local2++;
}
delete score_runner.first_pos;
delete score_runner.more_available;
}
function populateRanking() {
}
function get_scores() {
if (canConnect == false) {
activityList.push(Array("GET SCORES"));
return(undefined);
}
currentActivity = Array("GET SCORES");
canConnect = false;
var self = this;
var _local3 = new Date();
score_runner.score_interval = currentSpan;
if (currentSpan == "LEAGUE") {
score_runner.league_id = league;
} else {
score_runner.league_id = 0;
}
score_runner.start_pos = currentFirstPos;
score_runner.fiab_score_action = "GET_SCORE";
score_runner.rnd = _local3.getTime();
score_runner.onLoad = function (success) {
self.loadingMovie._visible = false;
if (success) {
if (this.errmsg == undefined) {
this.attemptCounter = 0;
trace("GET SCORES SUCCESSFULL!");
self.gotoAndStop("submited");
self.populateSubmited();
} else if (this.errmsg != undefined) {
self.handleError(this.errmsg);
}
} else {
trace("ERROR GETTING SCORES");
self.handleError("FAILED");
return(undefined);
}
self.canConnect = true;
delete this.score_interval;
delete this.rnd;
delete this.start_pos;
delete this.fiab_score_action;
delete this.league_id;
delete this.more_available;
delete this.currentSpan;
delete this.errmsg;
};
var _local2;
for (_local2 in score_runner) {
trace((_local2 + " : ") + score_runner[_local2]);
}
score_runner.sendAndLoad(serviceURL, score_runner, "GET");
trace("GOING TO LOADING");
doLoading();
}
function getScoresList(names, scores) {
if (canConnect == false) {
activityList.push(Array("GET SCORES"));
return(undefined);
}
currentActivity = Array("GET SCORES");
canConnect = false;
var self = this;
var _local3 = new Date();
score_runner.score_interval = currentSpan;
score_runner.league_id = league;
score_runner.start_pos = currentFirstPos;
score_runner.fiab_score_action = "GET_SCORE";
score_runner.rnd = _local3.getTime();
score_runner.onLoad = function (success) {
self.loadingMovie._visible = false;
if (success) {
if (this.errmsg == undefined) {
this.attemptCounter = 0;
trace("GET SCORES SUCCESSFULL!");
self.populateList(names, scores);
} else if (this.errmsg != undefined) {
self.handleError(this.errmsg);
}
} else {
trace("ERROR GETTING SCORES");
self.handleError("FAILED");
return(undefined);
}
self.canConnect = true;
delete this.score_interval;
delete this.rnd;
delete this.start_pos;
delete this.fiab_score_action;
delete this.league_id;
delete this.more_available;
delete this.currentSpan;
delete this.errmsg;
};
var _local2;
for (_local2 in score_runner) {
trace((_local2 + " : ") + score_runner[_local2]);
}
score_runner.sendAndLoad(serviceURL, score_runner, "GET");
trace("GOING TO LOADING");
doLoading();
}
function populateList(names, scores) {
var _local2 = 0;
while (_local2 < 99) {
if (score_runner["score" + _local2] == undefined) {
break;
}
if (((score_runner["score" + _local2] == "NONE") && (score_runner["name" + _local2] == "NONE")) && ((score_runner["location" + _local2] = "NONE"))) {
break;
}
names[_local2] = score_runner["name" + _local2];
scores[_local2] = score_runner["score" + _local2];
_local2++;
}
trace(names);
trace(scores);
}
function checkForLeagues() {
trace("CHECKING FOR LEAGUES");
trace("ROOT : " + theRoot);
trace("THIS : " + this);
trace("DEBUG : " + debugArea);
debugArea.text = "BOO!! CHECKING FOR LEAGUES";
debugArea.text = debugArea.text + (("\nROOT : " + theRoot) + newline);
trace("DEBUG TEXT " + debugArea.text);
if (theRoot.fiab_league_id != undefined) {
league = theRoot.fiab_league_id;
} else {
league = 0;
}
if (theRoot.fiab_league_player != undefined) {
league_player = theRoot.fiab_league_player;
} else {
league_player = 0;
}
trace("END CHECK FOR LEAGUES");
}
function submit(theScore, onSubmit, onCancel) {
var self = this;
var enterKeyListener = new Object();
enterKeyListener.onKeyDown = function () {
if (Key.isDown(13)) {
self.submitButton.onRelease();
}
};
score_id = new Number(0);
this.theScore = theScore;
this.onSubmit = onSubmit;
this.onCancel = onCancel;
_visible = true;
gotoAndStop("submit");
confirm._visible = false;
theScoreBox.text = String(theScore);
trace("PLAYER NAME " + player_name);
if (player_name != undefined) {
nameInput.text = player_name;
}
if (scoresAsTime == true) {
theScoreBox.text = secondsToString(Number(theScoreBox.text));
} else {
theScoreBox.text = addCommas(theScoreBox.text);
}
returnRank(theScore);
submitButton.onRelease = function () {
if (self.nameInput.text == "") {
return(undefined);
}
Key.removeListener(enterKeyListener);
self.submitScore(self.nameInput.text, self.theScore, self.onSubmit, 0);
};
skipitButton.onRelease = function () {
trace("GLOBAL SCORES : " + self.globalScoresOn);
if (self.onCancel) {
self.hideScores();
self.onCancel();
} else {
self.get_scores();
}
};
if (self.globalScoresOn == true) {
self.submitScore("", self.theScore, self.onCancel, 1);
}
Selection.setFocus(nameInput);
Key.addListener(enterKeyListener);
}
function justView() {
var _local2 = this;
gotoAndStop("view");
_visible = true;
get_scores();
}
function returnRank(theScoreToRank) {
if (canConnect == false) {
activityList.push(Array("RANK", theScoreToRank));
return(undefined);
}
var self = this;
canConnect = false;
currentActivity = Array("RANK", theScoreToRank);
trace("RETURNING REANK");
score_runner.fiab_score_action = "JUST_RANK";
score_runner.score = theScoreToRank;
score_runner.onLoad = function (success) {
self.loadingMovie._visible = false;
if (success) {
if (this.errmsg != undefined) {
self.handleError(this.errmsg);
} else {
self.attemptCounter = 0;
trace("RANK SUCCESS");
self.rankingText.text = self.generateRankText(this.first_pos, this.currentSpan);
}
} else {
trace("ERROR GETTING RANK");
self.handleError("FAILED");
}
delete this.first_pos;
delete this.fiab_score_action;
delete this.name;
delete this.score;
delete this.location;
delete this.currentSpan;
delete this.errmsg;
self.canConnect = true;
};
score_runner.sendAndLoad(serviceURL, score_runner, "GET");
}
function generateRankText(position, theSpan) {
trace("GENERATING RANK TEXT");
var _local1 = new String();
switch (theSpan) {
case "LEAGUE" :
_local1 = "in your league.";
break;
case "ALL" :
_local1 = "in the world ever!";
break;
case "YEAR" :
_local1 = "in the world this year.";
break;
case "MONTH" :
_local1 = "in the world this month.";
break;
case "WEEK" :
_local1 = "in the world this week.";
break;
case "DAY" :
_local1 = "in the world today.";
break;
default :
_local1 = ".";
}
return((("You ranked " + Number(Number(position) + Number(1))) + " ") + _local1);
}
function setupLeagueStartPage() {
var _local2;
var self = this;
var _local3 = this;
confirm._visible = false;
startLeagueButton._visible = false;
leagueNamesSoFar = 0;
previousButton._visible = false;
nextButton._visible = false;
delete leagueNameHolder.leagueStaterName;
delete leagueNameHolder.leagueStaterEmail;
_local2 = 1;
while (leagueNameHolder["name" + _local2] != undefined) {
delete leagueNameHolder["name" + _local2];
delete leagueNameHolder["email" + _local2];
_local2++;
}
_local2 = 1;
leagueStarterName.text = "";
leagueStarterEmail.text = "";
leagueStarterName.tabEnabled = true;
leagueStarterName.tabIndex = 1;
leagueStarterEmail.tabEnabled = true;
leagueStarterEmail.tabIndex = 2;
while (this["name" + _local2] != undefined) {
this["name" + _local2].text = "";
this["email" + _local2].text = "";
this["name" + _local2].tabEnabled = true;
this["email" + _local2].tabEnabled = true;
this["name" + _local2].tabIndex = 2 + (_local2 * 2);
this["email" + _local2].tabIndex = 3 + (_local2 * 2);
_local2++;
}
submitLeagueButton.onRelease = function () {
self.submitLeagueButtonRelease();
};
addMoreButton.onRelease = function () {
self.addMoreToLeague();
};
}
function submitLeagueButtonRelease() {
var _local2;
var _local3;
var _local4;
_local4 = leagueNamesSoFar;
trace((("LEAGE NAME " + leagueName) + " : ") + leagueName.text);
_local2 = 1;
while (this["name" + _local2] != undefined) {
trace("THIS NAME : " + _local3);
if (this["name" + _local2].text == "") {
_local2++;
continue;
}
_local3 = _local2 + _local4;
leagueNameHolder["name" + _local3] = new String();
leagueNameHolder["email" + _local3] = new String();
leagueNameHolder["name" + _local3] = this["name" + _local2].text;
leagueNameHolder["email" + _local3] = this["email" + _local2].text;
_local2++;
leagueNamesSoFar++;
}
leagueNameHolder.leagueStarterName = new String();
leagueNameHolder.leagueStarterEmail = new String();
leagueNameHolder.leagueStarterEmail = leagueStarterEmail.text;
leagueNameHolder.leagueStarterName = leagueStarterName.text;
leagueNameHolder.leagueName = new String();
leagueNameHolder.leagueName = leagueName.text;
trace("SUBMITTING LEAGUE");
for (_local2 in leagueNameHolder) {
trace((_local2 + " : ") + leagueNameHolder[_local2]);
}
trace(leagueNameHolder);
submitLeagueStart();
}
function addMoreToLeague() {
trace("ADDING MORE");
var _local2;
var _local3;
var _local4;
_local4 = leagueNamesSoFar;
_local2 = 1;
while (this["name" + _local2] != undefined) {
trace("THIS NAME : " + _local3);
if (this["name" + _local2].text == "") {
_local2++;
continue;
}
_local3 = _local2 + _local4;
leagueNameHolder["name" + _local3] = new String();
leagueNameHolder["email" + _local3] = new String();
leagueNameHolder["name" + _local3] = this["name" + _local2].text;
leagueNameHolder["email" + _local3] = this["email" + _local2].text;
this["name" + _local2].text = "";
this["email" + _local2].text = "";
leagueNamesSoFar++;
_local2++;
}
}
function submitLeagueStart() {
if (canConnect == false) {
activityList.push(Array("START_LEAGUE"));
return(undefined);
}
trace("CONNECTING FOR NEW LEAGUE");
currentActivity = Array("START_LEAGUE");
var _local3 = new Date();
var _local2;
var self = this;
score_runner.rnd = _local3.getTime();
score_runner.fiab_score_action = "START_LEAGUE";
score_runner.leagueStarterName = leagueNameHolder.leagueStarterName;
score_runner.leagueStarterEmail = leagueNameHolder.leagueStarterEmail;
score_runner.leagueName = leagueNameHolder.leagueName;
score_runner.viralName = viralName;
trace("PREPAREING FOR LEAGUE\n\n");
for (_local2 in leagueNameHolder) {
trace((_local2 + " : ") + leagueNameHolder[_local2]);
score_runner[_local2] = leagueNameHolder[_local2];
}
trace("LEAGUE PREPAED\n\n");
score_runner.onLoad = function (success) {
self.loadingMovie._visible = false;
var _local2;
trace("NEW LEAGUE ON LOAD");
if (success) {
if (this.errmsg != undefined) {
self.handleError(this.errmsg);
} else {
self.attemptCounter = 0;
trace("THE LEAGUE HAS BEEN STARTED : " + this.league);
self.league = this.league;
self.league_player = this.league_player;
this.theRoot.fiab_league_id = this.league;
this.theRoot.fiab_league_player = this.league_player;
self.leagueNameString = this.league_name;
self.gotoAndStop("leagueSuccess");
self.currentSpan = "LEAGUE";
self.populateSubmited();
}
} else {
self.handleError("FAILED");
}
delete this.rnd;
for (_local2 in self.leagueNameHolder) {
delete this[_local2];
}
delete this.fiab_score_action;
delete this.league;
delete this.league_player;
delete this.viralName;
delete this.league_name;
delete this.errmsg;
};
score_runner.sendAndLoad(serviceURL, score_runner, "GET");
doLoading();
}
function setupLeaveLeague() {
var self = this;
confirm._visible = true;
confirm.noButton.onRelease = function () {
self.confirm._visible = false;
};
confirm.yesButton.onRelease = function () {
trace("LEAVE FOREVER");
self.doLoading();
self.leaveForEver();
};
}
function leaveForEver() {
if (canConnect == false) {
activityList.push(Array("LEAVE_LEAGUE"));
return(undefined);
}
currentActivity = Array("LEAVE_LEAGUE");
var _local2 = new Date();
var self = this;
score_runner.rnd = _local2.getTime();
score_runner.fiab_score_action = "LEAVE_LEAGUE";
score_runner.league_player = league_player;
score_runner.onLoad = function (success) {
self.loadingMovie._visible = false;
if (success) {
self.attemptCounter = 0;
trace("SUCESSFULLY LEFT THE LEAGUE");
trace("LEAVE FOR EVER");
self.theRoot.fiab_league_id = 0;
self.theRoot.fiab_league_player = 0;
self.league = 0;
self.league_player = 0;
self.get_scores();
} else {
trace("leaving league failure");
self.handleError("FAILED");
}
delete this.rnd;
delete this.fiab_score_action;
delete this.errmsg;
};
score_runner.sendAndLoad(serviceURL, score_runner, "GET");
doLoading();
}
function doLoading() {
loadingMovie._visible = true;
}
function hideScores() {
_visible = false;
onHide();
}
function handleError(theError) {
trace("theError : " + theError);
var _local5 = new String();
switch (theError) {
case "LEAGUE LEFT" :
case "BEST SCORE" :
return(undefined);
case "SCORE TOO HIGH" :
case "SCORE TOO LOW" :
break;
case "NO NAME" :
default :
case "NO SCORE" :
case "NO CONNECTION" :
case "BAD LOCATION" :
case "BAD WORD" :
case "INVALID ID" :
case "NO REQUEST" :
case "NO LEAGUE CREATOR NAME" :
case "NO LEAGUE CREATOR EMAIL" :
case "NO LEAGUE BUDDIES" :
case "BAD SPAN" :
case "FAILED" :
if ((++attemptCounter) > 5) {
gotoAndStop("error");
} else {
activityList.unshift(currentActivity);
}
}
var _local2;
var _local3 = new Boolean(true);
debugArea.text = debugArea.text + "\nDELETING THESE ITEMS:";
for (_local2 in score_runner) {
_local3 = false;
switch (_local2) {
case "fiab_viral_id" :
case "league" :
case "league_player" :
case "viralID" :
_local3 = true;
break;
default :
_local3 = false;
}
if (_local3 == true) {
continue;
}
debugArea.text = debugArea.text + (((newline + _local2) + " : ") + score_runner[_local2]);
delete score_runner[_local2];
}
debugArea.text = debugArea.text + "\nDELETING COMPLETE\n";
}
function upDateFlag(theFlag, theFlagCode) {
var _local2;
_local2 = returnArrayIndex(theFlagCode, countryCodeArray);
if (_local2 < 0) {
theFlag.gotoAndStop("blank");
} else {
_local2++;
theFlag.gotoAndStop(_local2);
}
}
function returnArrayIndex(needle, haystack) {
var _local1;
_local1 = 0;
while (_local1 < haystack.length) {
if (needle == haystack[_local1]) {
return(_local1);
}
_local1++;
}
return(-1);
}
function secondsToString(t) {
var _local1 = 25;
var _local2 = (t * _local1) / 100;
var _local7 = Math.floor(_local2 / (_local1 * 60));
var _local8 = String(_local7);
_local2 = _local2 - (_local7 * (_local1 * 60));
var _local3 = Math.floor(_local2 / _local1);
var _local5 = String(_local3);
if (_local3 < 10) {
_local5 = "0" + String(_local3);
}
_local2 = _local2 - (_local3 * _local1);
var _local4 = Math.floor((_local2 / _local1) * 100);
var _local6 = String(_local4);
if (_local4 < 10) {
_local6 = "0" + String(_local4);
}
return(String((((_local8 + ":") + _local5) + ".") + _local6));
}
function addCommas(myString) {
if (myString == "NONE") {
return("NONE");
}
var _local2;
var _local1;
var _local5;
var _local3 = "";
_local2 = 0;
while (_local2 < myString.length) {
if (_local2 > 0) {
_local3 = "," + _local3;
}
_local1 = myString.length - (_local2 + 3);
if (_local1 < 0) {
_local5 = 3 + _local1;
_local1 = 0;
} else {
_local5 = 3;
}
_local3 = myString.substr(_local1, _local5) + _local3;
if (_local1 == 0) {
break;
}
_local2 = _local2 + 3;
}
return(_local3);
}
}
Symbol 1045 MovieClip [__Packages.Player] Frame 0
class Player
{
var maxSpeed, accel, grip, style, carName, parts, lapTimes, raceTime;
function Player () {
maxSpeed = 0;
accel = 0;
grip = 0;
style = 0;
carName = new String();
parts = new Array();
lapTimes = new Array();
raceTime = 0;
}
}
Symbol 1046 MovieClip [__Packages.NamePart] Frame 0
class NamePart
{
var str, wheel, engine, bodykit, decal;
function NamePart (id, w, e, b, d) {
str = id;
wheel = w;
engine = e;
bodykit = b;
decal = d;
}
}
Symbol 1047 MovieClip [__Packages.StopWatch] Frame 0
class StopWatch extends MovieClip
{
var __get__framerate, timeDisplay;
function StopWatch () {
super();
}
function set framerate(fps) {
this.fps = fps;
//return(__get__framerate());
}
function start() {
isRunning = true;
}
function stop() {
isRunning = false;
}
function reset() {
ticks = 0;
timeDisplay.text = "0:00.00";
}
function getCurrTime() {
return(Math.round((ticks / fps) * 100));
}
function onEnterFrame() {
if (isRunning) {
ticks++;
var _local2 = ticks;
var _local7 = Math.floor(_local2 / (fps * 60));
var _local8 = String(_local7);
_local2 = _local2 - (_local7 * (fps * 60));
var _local3 = Math.floor(_local2 / fps);
var _local5 = String(_local3);
if (_local3 < 10) {
_local5 = "0" + String(_local3);
}
_local2 = _local2 - (_local3 * fps);
var _local4 = Math.floor((_local2 / fps) * 100);
var _local6 = String(_local4);
if (_local4 < 10) {
_local6 = "0" + String(_local4);
}
timeDisplay.text = (((_local8 + ":") + _local5) + ".") + _local6;
}
}
var isRunning = false;
var ticks = 0;
var fps = 25;
}
Symbol 87 MovieClip Frame 20
gotoAndPlay (2);
Symbol 129 MovieClip Frame 1
stop();
Symbol 132 MovieClip Frame 1
stop();
Symbol 135 MovieClip Frame 1
stop();
Symbol 138 MovieClip Frame 1
stop();
Symbol 141 MovieClip Frame 1
stop();
Symbol 240 MovieClip Frame 1
gotoAndStop ("blank");
Symbol 297 MovieClip [highScoresSymbol] Frame 1
#initclip 11
Object.registerClass("highScoresSymbol", HighScores2);
#endinitclip
stop();
blocker.useHandCursor = false;
Symbol 460 Button
on (release) {
formcheck();
}
Symbol 469 MovieClip Frame 1
function validate(address) {
if (address.length >= 7) {
if (address.indexOf("@") > 0) {
if ((address.indexOf("@") + 2) < address.lastIndexOf(".")) {
if (address.lastIndexOf(".") < (address.length - 2)) {
return(true);
}
}
}
}
return(false);
}
function formcheck() {
errorFound = false;
if (((input1.text == null) || (input1.text.length < 1)) || (input1.text == "valid email required")) {
input1.text = error1;
errorFound = true;
}
if (!validate(input1.text)) {
input1.text = error1;
errorFound = true;
}
if (((input2.text == null) || (input2.text.length < 1)) || (input2.text == "valid email required")) {
input2.text = error1;
errorFound = true;
}
if (!validate(input2.text)) {
input2.text = error1;
errorFound = true;
}
if (errorFound == false) {
postSender = new LoadVars();
if ((month > 1) && (year > 2007)) {
postSender.txt = emailText2;
} else {
postSender.txt = emailText1;
}
postSender.subject = "The Fast and the Phineas game!";
postSender.sender = input1.text;
postSender.email = input2.text;
postSender.sendAndLoad("http://service.fishinabottle.com/disney/forward.php", postLoader);
_parent.trackObj.continueTracking("SF");
gotoAndStop ("sent");
}
}
stop();
var emailText1 = "Hi there!\n\nI have just played this awesome game called 'The Fast and the Phineas'. I built my own race car and raced it around a track with an opponent!\nI thought you'd like it too! Find out by clicking this link to play the game yourself!\n\nhttp://www.disney.co.uk/DisneyChannel/supersites/phineasandferb/fastandphineas\n\nBet you can't build a better car than me!\n\n'The Fast and the Phineas' game is brought to you by The Disney Channel. Catch Phineas and Ferb, premiering on 1st February, only on Disney channel!\nFind out more about Phineas and Ferb by visiting the Disney Channel website using the link below:\n\nhttp://www.disney.co.uk/DisneyChannel/supersites/phineasandferb";
var emailText2 = "Hi there!\n\nI have just played this awesome game called 'The Fast and the Phineas'. I built my own race car and raced it around a track with an opponent!\nI thought you'd like it too! Find out by clicking this link to play the game yourself!\n\nhttp://www.disney.co.uk/DisneyChannel/supersites/phineasandferb/fastandphineas\n\nBet you can't build a better car than me!\n\n'The Fast and the Phineas' game is brought to you by The Disney Channel. Catch Phineas and Ferb, weekdays at 4pm and weekends at 8.30am, only on Disney Channel!\nFind out more about Phineas and Ferb by visiting the Disney Channel website using the link below:\n\nhttp://www.disney.co.uk/DisneyChannel/supersites/phineasandferb";
var todayDate = new Date();
var month = (todayDate.getMonth() + 1);
var year = (todayDate.getFullYear() + 1);
var postLoader;
errorFound = false;
error1 = "valid email required";
error2 = "input required";
Selection.setFocus("youremail");
input1.tabIndex = 1;
input2.tabIndex = 2;
postLoader = new LoadVars();
postLoader.onLoad = function () {
};
Symbol 548 MovieClip Frame 1
blocker.useHandCursor = false;
Symbol 549 MovieClip Frame 1
stop();
Symbol 549 MovieClip Frame 11
_parent.transFunc();
Symbol 549 MovieClip Frame 17
gotoAndStop ("off");
Symbol 566 MovieClip Frame 1
stop();
Symbol 567 MovieClip Frame 1
stop();
Symbol 567 MovieClip Frame 29
stop();
_parent.partReady(true);
Symbol 580 MovieClip Frame 1
stop();
Symbol 582 MovieClip Frame 30
stop();
_parent.partReady(true);
Symbol 595 MovieClip Frame 1
stop();
Symbol 595 MovieClip Frame 10
stop();
Symbol 595 MovieClip Frame 30
stop();
Symbol 604 MovieClip Frame 1
stop();
Symbol 604 MovieClip Frame 10
stop();
Symbol 604 MovieClip Frame 30
stop();
Symbol 613 MovieClip Frame 1
stop();
Symbol 613 MovieClip Frame 10
stop();
Symbol 613 MovieClip Frame 30
stop();
Symbol 622 MovieClip Frame 1
stop();
Symbol 622 MovieClip Frame 10
stop();
Symbol 622 MovieClip Frame 30
stop();
Symbol 631 MovieClip Frame 1
stop();
Symbol 631 MovieClip Frame 10
stop();
Symbol 631 MovieClip Frame 30
stop();
Symbol 641 MovieClip Frame 1
stop();
Symbol 641 MovieClip Frame 10
stop();
Symbol 641 MovieClip Frame 30
stop();
Symbol 650 MovieClip Frame 1
stop();
Symbol 650 MovieClip Frame 10
stop();
Symbol 650 MovieClip Frame 30
stop();
Symbol 651 MovieClip Frame 1
stop();
Symbol 654 MovieClip Frame 1
stop();
Symbol 654 MovieClip Frame 29
stop();
_parent.partReady(true);
Symbol 670 MovieClip Frame 1
stop();
Symbol 672 MovieClip Frame 1
stop();
Symbol 672 MovieClip Frame 14
stop();
_parent.partReady(true);
Symbol 691 MovieClip Frame 1
stop();
Symbol 702 MovieClip Frame 1
stop();
Symbol 702 MovieClip Frame 40
stop();
_parent.partReady(true);
Symbol 716 MovieClip Frame 1
stop();
Symbol 717 MovieClip Frame 1
stop();
_parent.isEngineIn = false;
Symbol 717 MovieClip Frame 25
stop();
_parent.partReady(true);
_parent.isEngineIn = true;
Symbol 717 MovieClip Frame 42
stop();
Symbol 740 MovieClip Frame 1
stop();
Symbol 740 MovieClip Frame 10
stop();
_parent.partReady(true);
Symbol 830 MovieClip Frame 1
_visible = false;
Symbol 832 MovieClip Frame 1
_visible = false;
Symbol 834 MovieClip Frame 1
_visible = false;
Symbol 843 MovieClip Frame 1
stop();
Symbol 843 MovieClip Frame 4
gotoAndPlay (1);
Symbol 843 MovieClip Frame 70
_parent.startRace();
Symbol 847 MovieClip Frame 4
gotoAndPlay (1);
Symbol 847 MovieClip Frame 85
_parent.onRaceWon();
Symbol 888 MovieClip [timer] Frame 1
#initclip 12
Object.registerClass("timer", StopWatch);
#endinitclip
Symbol 1036 MovieClip Frame 1
function validate(address) {
if (address.length >= 7) {
if (address.indexOf("@") > 0) {
if ((address.indexOf("@") + 2) < address.lastIndexOf(".")) {
if (address.lastIndexOf(".") < (address.length - 2)) {
return(true);
}
}
}
}
return(false);
}
function formcheck() {
errorFound = false;
if (((input1.text == null) || (input1.text.length < 1)) || (input1.text == "valid email required")) {
input1.text = error1;
errorFound = true;
}
if (!validate(input1.text)) {
input1.text = error1;
errorFound = true;
}
if (((input2.text == null) || (input2.text.length < 1)) || (input2.text == "valid email required")) {
input2.text = error1;
errorFound = true;
}
if (!validate(input2.text)) {
input2.text = error1;
errorFound = true;
}
if (errorFound == false) {
postSender = new LoadVars();
if ((month > 1) && (year > 2007)) {
postSender.txt = emailText2;
} else {
postSender.txt = emailText1;
}
postSender.subject = "I challenge you! How fast can you go?";
postSender.sender = input1.text;
postSender.email = input2.text;
postSender.sendAndLoad("http://service.fishinabottle.com/disney/forward.php", postLoader);
_parent.trackObj.continueTracking("SF");
gotoAndStop ("sent");
}
}
stop();
var emailText1 = (("Hi there!\n\nI have just played this awesome game called 'The Fast and the Phineas'. I built my own race car and raced it around a track with an opponent!\n\nI scored " + _parent.challengeScore) + ". Bet you can't build a better car than me and beat my score! I challenge you to play the game to find out.\n\nhttp://www.disney.co.uk/DisneyChannel/supersites/phineasandferb/fastandphineas\n\n'The Fast and the Phineas' game is brought to you by The Disney Channel. Catch Phineas and Ferb, premiering on 1st February, only on Disney channel!\nFind out more about Phineas and Ferb by visiting the Disney Channel website using the link below:\n\nhttp://www.disney.co.uk/DisneyChannel/supersites/phineasandferb");
var emailText2 = (("Hi there!\n\nI have just played this awesome game called 'The Fast and the Phineas'. I built my own race car and raced it around a track with an opponent!\n\nI scored " + _parent.challengeScore) + ". Bet you can't build a better car than me and beat my score! I challenge you to play the game to find out.\n\nhttp://www.disney.co.uk/DisneyChannel/supersites/phineasandferb/fastandphineas\n\n'The Fast and the Phineas' game is brought to you by The Disney Channel. Catch Phineas and Ferb, weekdays at 4pm and weekends at 8.30am, only on Disney Channel!\nFind out more about Phineas and Ferb by visiting the Disney Channel website using the link below:\n\nhttp://www.disney.co.uk/DisneyChannel/supersites/phineasandferb");
var todayDate = new Date();
var month = (todayDate.getMonth() + 1);
var year = (todayDate.getFullYear() + 1);
var postLoader;
errorFound = false;
error1 = "valid email required";
error2 = "input required";
Selection.setFocus("youremail");
input1.tabIndex = 1;
input2.tabIndex = 2;
postLoader = new LoadVars();
postLoader.onLoad = function () {
};
Symbol 1037 MovieClip Frame 1
function gotoBuild() {
gotoAndStop ("build");
}
function gotoRace() {
gotoAndStop ("race");
}
function gotoResult() {
gotoAndStop ("result");
}
stop();
var FPS = 25;
var P1_ACCELERATE = 38;
var P1_REVERSE = 40;
var P1_LEFT = 37;
var P1_RIGHT = 39;
var P1_BOOST = 17;
var P2_ACCELERATE = 87;
var P2_REVERSE = 83;
var P2_LEFT = 65;
var P2_RIGHT = 68;
var P2_BOOST = 16;
var PLAYER_PHINEUS = 1;
var PLAYER_FERB = 2;
var numPlayers;
var playerChar;
var car1Settings = new Array(2, 1, 1, 1, 4);
var car2Settings = new Array(1, 2, 1, 4, 3);
var players = new Array(new Player(), new Player());
var currPlayer = 0;
players[0].grip = 3;
players[0].accel = 3;
players[0].maxSpeed = 3;
players[0].style = 3;
players[0].parts = new Array(2, 1, 1, 1, 4);
players[1].grip = 3;
players[1].accel = 3;
players[1].maxSpeed = 3;
players[1].style = 3;
players[1].parts = new Array(2, 1, 1, 1, 4);
button1PPhineus.onRelease = function () {
numPlayers = 1;
playerChar = PLAYER_PHINEUS;
transition.gotoAndPlay("close");
transFunc = gotoBuild;
_parent.sfxClick.start();
};
button1PFerb.onRelease = function () {
numPlayers = 1;
playerChar = PLAYER_FERB;
transition.gotoAndPlay("close");
transFunc = gotoBuild;
_parent.sfxClick.start();
};
button2P.onRelease = function () {
numPlayers = 2;
playerChar = PLAYER_PHINEUS;
transition.gotoAndPlay("close");
transFunc = gotoBuild;
_parent.sfxClick.start();
};
sfxCarIdle = new Sound(this.createEmptyMovieClip("sfx1", 5001));
sfxCarIdle.attachSound("baseidle.wav");
sfxCarFlatOut = new Sound(this.createEmptyMovieClip("sfx2", 5002));
sfxCarFlatOut.attachSound("baseflatout.wav");
sfxCarIncrease = new Sound(this.createEmptyMovieClip("sfx3", 5003));
sfxCarIncrease.attachSound("baseinc.wav");
sfxCarIncrease.onSoundComplete = function () {
sfxCarFlatOut.start(0, 99999);
};
sfxCarDecrease = new Sound(this.createEmptyMovieClip("sfx4", 5004));
sfxCarDecrease.attachSound("basedec.wav");
sfxCarDecrease.onSoundComplete = function () {
sfxCarIdle.start(0, 99999);
};
sfxSkid1 = new Sound(this.createEmptyMovieClip("sfx5", 5005));
sfxSkid1.attachSound("screech1.wav");
sfxSkid2 = new Sound(this.createEmptyMovieClip("sfx6", 5006));
sfxSkid2.attachSound("screech2.wav");
sfxSkid3 = new Sound(this.createEmptyMovieClip("sfx7", 5007));
sfxSkid3.attachSound("screech3.wav");
sfxDirtTerrain = new Sound(this.createEmptyMovieClip("sfx8", 5008));
sfxDirtTerrain.attachSound("rough.wav");
sfxBoost = new Sound(this.createEmptyMovieClip("sfx9", 5009));
sfxBoost.attachSound("boost.wav");
sfxRaceLoop = new Sound(this.createEmptyMovieClip("sfx10", 5010));
sfxRaceLoop.attachSound("raceloop.wav");
var transFunc;
Symbol 1037 MovieClip Frame 6
function updateName() {
players[currPlayer].carName = (((part1[pt1Pos].str + " ") + part2[pt2Pos].str) + " ") + part3[pt3Pos].str;
nameMaker.carName.carName.text = players[currPlayer].carName;
calcStyleRating();
}
function calcStyleRating() {
players[currPlayer].style = 1;
if (part1[pt1Pos].wheel == players[currPlayer].parts[0]) {
players[currPlayer].style++;
}
if (part1[pt1Pos].engine == players[currPlayer].parts[2]) {
players[currPlayer].style++;
}
if (part1[pt1Pos].bodykit == players[currPlayer].parts[3]) {
players[currPlayer].style++;
}
if (part1[pt1Pos].decal == players[currPlayer].parts[4]) {
players[currPlayer].style++;
}
if (part2[pt2Pos].wheel == players[currPlayer].parts[0]) {
players[currPlayer].style++;
}
if (part2[pt2Pos].engine == players[currPlayer].parts[2]) {
players[currPlayer].style++;
}
if (part2[pt2Pos].bodykit == players[currPlayer].parts[3]) {
players[currPlayer].style++;
}
if (part2[pt2Pos].bodykit == players[currPlayer].parts[3]) {
trace("SHARK!");
}
if (part2[pt2Pos].decal == players[currPlayer].parts[4]) {
players[currPlayer].style++;
}
if (part3[pt3Pos].wheel == players[currPlayer].parts[0]) {
players[currPlayer].style++;
}
if (part3[pt3Pos].engine == players[currPlayer].parts[2]) {
players[currPlayer].style++;
}
if (part3[pt3Pos].bodykit == players[currPlayer].parts[3]) {
players[currPlayer].style++;
}
if (part3[pt3Pos].decal == players[currPlayer].parts[4]) {
players[currPlayer].style++;
}
}
function partReady(flag) {
nextButton.enabled = flag;
prevButton.enabled = flag;
okButton.enabled = flag;
wheelsButton.enabled = flag;
chasisButton.enabled = flag;
engineButton.enabled = flag;
bodykitButton.enabled = flag;
decalButton.enabled = flag;
nameButton.enabled = flag;
}
function jumpToPart(part) {
if (currPart == PART_ENGINE) {
engineClip.gotoAndStop(1);
chasisClip.body.hood.gotoAndStop(1);
}
if (currPart == PART_NAME) {
nameMaker.carName.pt1Next._visible = false;
nameMaker.carName.pt1Prev._visible = false;
nameMaker.carName.pt2Next._visible = false;
nameMaker.carName.pt2Prev._visible = false;
nameMaker.carName.pt3Next._visible = false;
nameMaker.carName.pt3Prev._visible = false;
randomButton._visible = false;
nextButton._visible = true;
prevButton._visible = true;
}
if (part == PART_ENGINE) {
colourWheels.colorTransform = blackColour;
colourChasis.colorTransform = blackColour;
colourBodykit.colorTransform = blackColour;
colourDecals.colorTransform = blackColour;
colourBack.colorTransform = blackColour;
engineEdit._visible = true;
} else {
colourWheels.colorTransform = normalColour;
colourChasis.colorTransform = normalColour;
colourBodykit.colorTransform = normalColour;
colourDecals.colorTransform = normalColour;
colourBack.colorTransform = normalColour;
engineEdit._visible = false;
}
if (part == PART_NAME) {
nameMaker.carName.pt1Next._visible = true;
nameMaker.carName.pt1Prev._visible = true;
nameMaker.carName.pt2Next._visible = true;
nameMaker.carName.pt2Prev._visible = true;
nameMaker.carName.pt3Next._visible = true;
nameMaker.carName.pt3Prev._visible = true;
randomButton._visible = true;
nextButton._visible = false;
prevButton._visible = false;
}
currPart = part;
partId.gotoAndStop(currPart + 1);
}
function partSelected() {
switch (currPart) {
case PART_WHEELS :
if (!partsDone[currPart]) {
partReady(false);
partsDone[currPart] = true;
chasisClip.play();
backClip.play();
chasisButton._visible = true;
}
buttonGlow._x = buttonGlow._x + 60;
currPart++;
break;
case PART_CHASIS :
if (!partsDone[PART_ENGINE]) {
partReady(false);
partsDone[currPart] = true;
chasisClip.body.hood.play();
engineClip.play();
engineButton._visible = true;
} else {
colourWheels.colorTransform = blackColour;
colourChasis.colorTransform = blackColour;
colourBodykit.colorTransform = blackColour;
colourDecals.colorTransform = blackColour;
colourBack.colorTransform = blackColour;
engineEdit._visible = true;
}
buttonGlow._x = buttonGlow._x + 60;
currPart++;
break;
case PART_ENGINE :
if (!partsDone[currPart]) {
partReady(false);
partsDone[currPart] = true;
if (isEngineIn) {
engineClip.play();
chasisClip.body.hood.play();
}
colourWheels.colorTransform = normalColour;
colourChasis.colorTransform = normalColour;
colourBodykit.colorTransform = normalColour;
colourDecals.colorTransform = normalColour;
colourBack.colorTransform = normalColour;
engineEdit._visible = false;
bodykitClip.play();
bodykitButton._visible = true;
} else {
colourWheels.colorTransform = normalColour;
colourChasis.colorTransform = normalColour;
colourBodykit.colorTransform = normalColour;
colourDecals.colorTransform = normalColour;
colourBack.colorTransform = normalColour;
engineEdit._visible = false;
}
buttonGlow._x = buttonGlow._x + 60;
currPart++;
break;
case PART_BODYKIT :
if (!partsDone[currPart]) {
partReady(false);
partsDone[currPart] = true;
decalsClip.play();
decalButton._visible = true;
}
buttonGlow._x = buttonGlow._x + 60;
currPart++;
break;
case PART_DECALS :
if (!partsDone[currPart]) {
partReady(false);
partsDone[currPart] = true;
nameButton._visible = true;
nameMaker.play();
}
nextButton._visible = false;
prevButton._visible = false;
nameMaker.carName.pt1Next._visible = true;
nameMaker.carName.pt1Prev._visible = true;
nameMaker.carName.pt2Next._visible = true;
nameMaker.carName.pt2Prev._visible = true;
nameMaker.carName.pt3Next._visible = true;
nameMaker.carName.pt3Prev._visible = true;
randomButton._visible = true;
buttonGlow._x = buttonGlow._x + 60;
currPart++;
break;
case PART_NAME :
players[currPlayer].grip = ((wheelRatios[0] * wheelGrip[players[currPlayer].parts[0] - 1]) + (engineRatios[0] * engineGrip[players[currPlayer].parts[2] - 1])) + (bodykitRatios[0] * bodykitGrip[players[currPlayer].parts[3] - 1]);
players[currPlayer].accel = ((wheelRatios[1] * wheelAccel[players[currPlayer].parts[0] - 1]) + (engineRatios[1] * engineAccel[players[currPlayer].parts[2] - 1])) + (bodykitRatios[1] * bodykitAccel[players[currPlayer].parts[3] - 1]);
players[currPlayer].maxSpeed = ((wheelRatios[2] * wheelMax[players[currPlayer].parts[0] - 1]) + (engineRatios[2] * engineMax[players[currPlayer].parts[2] - 1])) + (bodykitRatios[2] * bodykitMax[players[currPlayer].parts[3] - 1]);
wheelsButton._visible = false;
chasisButton._visible = false;
engineButton._visible = false;
bodykitButton._visible = false;
decalButton._visible = false;
nameButton._visible = false;
buttonGlow._visible = false;
nameMaker.carName.pt1Next._visible = false;
nameMaker.carName.pt1Prev._visible = false;
nameMaker.carName.pt2Next._visible = false;
nameMaker.carName.pt2Prev._visible = false;
nameMaker.carName.pt3Next._visible = false;
nameMaker.carName.pt3Prev._visible = false;
randomButton._visible = false;
stats.statMax.gotoAndStop(Math.round(players[currPlayer].maxSpeed));
stats.statGrip.gotoAndStop(Math.round(players[currPlayer].grip));
stats.statAccel.gotoAndStop(Math.round(players[currPlayer].accel));
stats.statStyle.gotoAndStop(players[currPlayer].style);
stats._visible = true;
printButton._visible = true;
raceButton._visible = true;
okButton._visible = false;
playerId._visible = false;
partId._visible = false;
}
partId.gotoAndStop(currPart + 1);
}
function printCar() {
var _local2 = new PrintJob();
if (_local2.start()) {
var _local3 = false;
if (_local2.orientation == "portrait") {
printout._visible = true;
_local3 = _local2.addPage(this, {xMin:640, xMax:1240, yMin:0, yMax:800}, {printAsBitmap:true});
} else {
printout._rotation = 270;
printout._y = 596;
printout._visible = true;
_local3 = _local2.addPage(this, {xMin:640, xMax:1440, yMin:0, yMax:600}, {printAsBitmap:true});
}
if (_local3) {
_local2.send();
printout._visible = false;
}
}
}
function resetBuild() {
currPart = 0;
partsDone = new Array(false, false, false, false, false, false);
stats._visible = false;
printButton._visible = false;
raceButton._visible = false;
chasisButton._visible = false;
engineButton._visible = false;
bodykitButton._visible = false;
decalButton._visible = false;
nameButton._visible = false;
randomButton._visible = false;
okButton._visible = true;
nextButton._visible = true;
prevButton._visible = true;
wheelsButton._visible = true;
buttonGlow._visible = true;
buttonGlow._x = wheelsButton._x;
engineEdit._visible = false;
pt1Pos = Math.floor(Math.random() * part1.length);
pt2Pos = Math.floor(Math.random() * part2.length);
pt3Pos = Math.floor(Math.random() * part3.length);
updateName();
wheelsClip.gotoAndPlay(1);
wheelsClip.wheels.gotoAndStop(1);
chasisClip.gotoAndStop(1);
backClip.gotoAndStop(1);
chasisClip.body.gotoAndStop(1);
chasisClip.body.hood.gotoAndStop(1);
backClip.back.gotoAndStop(1);
engineClip.gotoAndStop(1);
engineClip.engine.gotoAndStop(1);
bodykitClip.gotoAndStop(1);
bodykitClip.bodykit.gotoAndStop(1);
decalsClip.gotoAndStop(1);
decalsClip.decals.gotoAndStop(1);
nameMaker.gotoAndStop(1);
partReady(false);
playerId._visible = true;
partId._visible = true;
playerId.gotoAndStop(currPlayer + 1);
partId.gotoAndStop(1);
isEngineIn = false;
}
stop();
playerId.gotoAndStop(currPlayer + 1);
partId.gotoAndStop(1);
var PART_WHEELS = 0;
var PART_CHASIS = 1;
var PART_ENGINE = 2;
var PART_BODYKIT = 3;
var PART_DECALS = 4;
var PART_NAME = 5;
var currPart = 0;
var isEngineIn = false;
var partsDone = new Array(false, false, false, false, false, false);
var wheelGrip = new Array(2, 4, 1, 5, 3, 2);
var wheelAccel = new Array(2, 4, 2, 3, 3, 3);
var wheelMax = new Array(5, 3, 3, 1, 2, 4);
var engineGrip = new Array(4, 4, 2, 3, 3, 3);
var engineAccel = new Array(2, 3, 3, 4, 3, 3);
var engineMax = new Array(3, 2, 5, 2, 1, 3);
var bodykitGrip = new Array(3, 1, 2, 5, 1, 2, 3, 1, 4);
var bodykitAccel = new Array(3, 2, 3, 4, 2, 3, 3, 3, 2);
var bodykitMax = new Array(3, 4, 3, 2, 5, 4, 3, 5, 2);
var wheelRatios = new Array(0.6, 0.3, 0.1);
var engineRatios = new Array(0.3, 0.2, 0.5);
var bodykitRatios = new Array(0.1, 0.5, 0.4);
stats._visible = false;
printButton._visible = false;
raceButton._visible = false;
randomButton._visible = false;
var nClassic = new NamePart("classic", 0, 2, 1, 0);
var nSlick = new NamePart("slick", 1, 0, 3, 0);
var nFlying = new NamePart("flying", 0, 0, 4, 0);
var nMighty = new NamePart("mighty", 0, 0, 6, 0);
var nFlaming = new NamePart("flaming", 0, 0, 0, 2);
var nPro = new NamePart("pro", 0, 0, 0, 3);
var nRetro = new NamePart("retro", 0, 0, 9, 0);
var nSuper = new NamePart("super", 0, 0, 5, 8);
var nExtreme = new NamePart("extreme", 0, 0, 4, 0);
var nShark = new NamePart("shark", 0, 0, 2, 0);
var nTurbo = new NamePart("turbo", 0, 1, 0, 0);
var nPower = new NamePart("power", 0, 3, 0, 0);
var nSpeedy = new NamePart("speedy", 0, 4, 0, 0);
var nElectro = new NamePart("electro", 0, 5, 0, 6);
var nSafari = new NamePart("safari", 0, 0, 0, 5);
var nJet = new NamePart("jet", 0, 3, 8, 0);
var nVegetable = new NamePart("vegetable", 0, 2, 0, 0);
var nMetal = new NamePart("metal", 4, 0, 0, 2);
var nCruiser = new NamePart("cruiser", 2, 0, 0, 0);
var nTrolley = new NamePart("trolley", 3, 0, 0, 0);
var nTank = new NamePart("tank", 4, 0, 0, 0);
var nRacer = new NamePart("racer", 5, 0, 0, 0);
var nRoadster = new NamePart("roadster", 6, 0, 0, 0);
var nCab = new NamePart("cab", 0, 0, 7, 7);
var nRocket = new NamePart("rocket", 0, 0, 8, 0);
var nShed = new NamePart("shed", 0, 0, 9, 0);
var nCar = new NamePart("car", 1, 0, 0, 0);
var part1 = new Array(nClassic, nSlick, nFlying, nMighty, nFlaming, nPro, nRetro, nSuper, nExtreme);
var part2 = new Array(nShark, nTurbo, nPower, nSpeedy, nElectro, nSafari, nJet, nVegetable, nMetal);
var part3 = new Array(nCruiser, nTrolley, nTank, nRacer, nRoadster, nCab, nRocket, nShed, nCar);
var pt1Pos = Math.floor(Math.random() * part1.length);
var pt2Pos = Math.floor(Math.random() * part2.length);
var pt3Pos = Math.floor(Math.random() * part3.length);
updateName();
nameMaker.carName.pt1Next.onRelease = function () {
pt1Pos++;
if (pt1Pos > (part1.length - 1)) {
pt1Pos = 0;
}
_parent.sfxClick.start();
updateName();
};
nameMaker.carName.pt1Prev.onRelease = function () {
pt1Pos--;
if (pt1Pos < 0) {
pt1Pos = part1.length - 1;
}
_parent.sfxClick.start();
updateName();
};
nameMaker.carName.pt2Next.onRelease = function () {
pt2Pos++;
if (pt2Pos > (part2.length - 1)) {
pt2Pos = 0;
}
_parent.sfxClick.start();
updateName();
};
nameMaker.carName.pt2Prev.onRelease = function () {
pt2Pos--;
if (pt2Pos < 0) {
pt2Pos = part2.length - 1;
}
_parent.sfxClick.start();
updateName();
};
nameMaker.carName.pt3Next.onRelease = function () {
pt3Pos++;
if (pt3Pos > (part3.length - 1)) {
pt3Pos = 0;
}
_parent.sfxClick.start();
updateName();
};
nameMaker.carName.pt3Prev.onRelease = function () {
pt3Pos--;
if (pt3Pos < 0) {
pt3Pos = part3.length - 1;
}
_parent.sfxClick.start();
updateName();
};
randomButton.onRelease = function () {
pt1Pos = Math.floor(Math.random() * part1.length);
pt2Pos = Math.floor(Math.random() * part2.length);
pt3Pos = Math.floor(Math.random() * part3.length);
_parent.sfxClick.start();
updateName();
};
engineEdit._visible = false;
var colourWheels = (new flash.geom.Transform(wheelsClip));
var colourChasis = (new flash.geom.Transform(chasisClip));
var colourBodykit = (new flash.geom.Transform(bodykitClip));
var colourDecals = (new flash.geom.Transform(decalsClip));
var colourBack = (new flash.geom.Transform(backClip));
var blackColour = (new flash.geom.ColorTransform(1, 1, 1, 1, -255, -255, -255, 0));
var normalColour = (new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0));
chasisButton._visible = false;
engineButton._visible = false;
bodykitButton._visible = false;
decalButton._visible = false;
nameButton._visible = false;
wheelsButton.onRelease = function () {
jumpToPart(PART_WHEELS);
buttonGlow._x = wheelsButton._x;
_parent.sfxClick.start();
};
chasisButton.onRelease = function () {
jumpToPart(PART_CHASIS);
buttonGlow._x = chasisButton._x;
_parent.sfxClick.start();
};
engineButton.onRelease = function () {
jumpToPart(PART_ENGINE);
buttonGlow._x = engineButton._x;
_parent.sfxClick.start();
};
bodykitButton.onRelease = function () {
jumpToPart(PART_BODYKIT);
buttonGlow._x = bodykitButton._x;
_parent.sfxClick.start();
};
decalButton.onRelease = function () {
jumpToPart(PART_DECALS);
buttonGlow._x = decalButton._x;
_parent.sfxClick.start();
};
nameButton.onRelease = function () {
jumpToPart(PART_NAME);
buttonGlow._x = nameButton._x;
_parent.sfxClick.start();
};
partReady(false);
nextButton.onRelease = function () {
switch (currPart) {
case PART_WHEELS :
if (wheelsClip.wheels._currentframe == wheelsClip.wheels._totalframes) {
wheelsClip.wheels.gotoAndStop(1);
} else {
wheelsClip.wheels.nextFrame();
}
players[currPlayer].parts[currPart] = wheelsClip.wheels._currentframe;
break;
case PART_CHASIS :
if (chasisClip.body._currentframe == chasisClip.body._totalframes) {
chasisClip.body.gotoAndStop(1);
backClip.back.gotoAndStop(1);
} else {
chasisClip.body.nextFrame();
backClip.back.nextFrame();
}
players[currPlayer].parts[currPart] = chasisClip.body._currentframe;
break;
case PART_ENGINE :
if (engineClip.engine._currentframe == engineClip.engine._totalframes) {
engineClip.engine.gotoAndStop(1);
} else {
engineClip.engine.nextFrame();
}
engineEdit.gotoAndStop(engineClip.engine._currentframe);
players[currPlayer].parts[currPart] = engineClip.engine._currentframe;
break;
case PART_BODYKIT :
if (bodykitClip.bodykit._currentframe == bodykitClip.bodykit._totalframes) {
bodykitClip.bodykit.gotoAndStop(1);
} else {
bodykitClip.bodykit.nextFrame();
}
players[currPlayer].parts[currPart] = bodykitClip.bodykit._currentframe;
break;
case PART_DECALS :
if (decalsClip.decals._currentframe == decalsClip.decals._totalframes) {
decalsClip.decals.gotoAndStop(1);
} else {
decalsClip.decals.nextFrame();
}
players[currPlayer].parts[currPart] = decalsClip.decals._currentframe;
}
_parent.sfxClick.start();
};
prevButton.onRelease = function () {
switch (currPart) {
case PART_WHEELS :
if (wheelsClip.wheels._currentframe == 1) {
wheelsClip.wheels.gotoAndStop(wheelsClip.wheels._totalframes);
} else {
wheelsClip.wheels.prevFrame();
}
players[currPlayer].parts[currPart] = wheelsClip.wheels._currentframe;
break;
case PART_CHASIS :
if (chasisClip.body._currentframe == 1) {
chasisClip.body.gotoAndStop(chasisClip.body._totalframes);
backClip.back.gotoAndStop(backClip.back._totalframes);
} else {
chasisClip.body.prevFrame();
backClip.back.prevFrame();
}
players[currPlayer].parts[currPart] = chasisClip.body._currentframe;
break;
case PART_ENGINE :
if (engineClip.engine._currentframe == 1) {
engineClip.engine.gotoAndStop(engineClip.engine._totalframes);
} else {
engineClip.engine.prevFrame();
}
engineEdit.gotoAndStop(engineClip.engine._currentframe);
players[currPlayer].parts[currPart] = engineClip.engine._currentframe;
break;
case PART_BODYKIT :
if (bodykitClip.bodykit._currentframe == 1) {
bodykitClip.bodykit.gotoAndStop(bodykitClip.bodykit._totalframes);
} else {
bodykitClip.bodykit.prevFrame();
}
players[currPlayer].parts[currPart] = bodykitClip.bodykit._currentframe;
break;
case PART_DECALS :
if (decalsClip.decals._currentframe == 1) {
decalsClip.decals.gotoAndStop(decalsClip.decals._totalframes);
} else {
decalsClip.decals.prevFrame();
}
players[currPlayer].parts[currPart] = decalsClip.decals._currentframe;
}
_parent.sfxClick.start();
};
okButton.onRelease = function () {
partSelected();
_parent.sfxClick.start();
};
printout._visible = false;
printButton.onRelease = function () {
printout.car.wheels.gotoAndStop(players[currPlayer].parts[PART_WHEELS]);
printout.car.chasis.gotoAndStop(players[currPlayer].parts[PART_CHASIS]);
printout.car.back.gotoAndStop(players[currPlayer].parts[PART_CHASIS]);
printout.car.bodykit.gotoAndStop(players[currPlayer].parts[PART_BODYKIT]);
printout.car.decals.gotoAndStop(players[currPlayer].parts[PART_DECALS]);
printout.carName.text = players[currPlayer].carName;
printout.statMax.gotoAndStop(Math.round(players[currPlayer].maxSpeed));
printout.statGrip.gotoAndStop(Math.round(players[currPlayer].grip));
printout.statAccel.gotoAndStop(Math.round(players[currPlayer].accel));
printout.statStyle.gotoAndStop(players[currPlayer].style);
printCar();
_parent.sfxClick.start();
};
raceButton.onRelease = function () {
if ((numPlayers > 1) && (currPlayer == 0)) {
currPlayer++;
transFunc = resetBuild;
} else {
transFunc = gotoRace;
}
transition.gotoAndPlay("close");
_parent.sfxClick.start();
};
Symbol 1037 MovieClip Frame 11
function cpuUpdate(car) {
if ((!car.isRacing) || (car.playerId)) {
return(undefined);
}
if (waypoints[car.currWaypoint].hitTest(car._x, car._y, true)) {
car.currWaypoint++;
if (car.currWaypoint >= waypoints.length) {
car.currWaypoint = 0;
}
}
var _local4 = new Vector2D(waypoints[car.currWaypoint]._x - car._x, waypoints[car.currWaypoint]._y - car._y);
var _local3 = new Vector2D();
_local3.vector(car._rotation);
var _local2 = _local3.cross(_local4);
if (_local2 < -5) {
car.turnLeft();
} else if (_local2 > 5) {
car.turnRight();
}
if (Math.abs(_local2) < 25) {
car.accelerate();
} else if (car.speed < 3.5) {
car.accelerate();
}
}
function updateShadows() {
shadow1._x = p1._x + 2;
shadow1._y = p1._y + 4;
shadow1._rotation = p1._rotation;
shadow2._x = p2._x + 2;
shadow2._y = p2._y + 4;
shadow2._rotation = p2._rotation;
}
function updateSkidMarks(car) {
if (car.isSkidding) {
car.skidmarks.gotoAndStop(2);
car.skidTime++;
if (car.skidTime > 5) {
car.skidmarks.gotoAndStop(1);
car.endSkid();
}
}
car.skidmarks._x = car._x;
car.skidmarks._y = car._y;
car.skidmarks._rotation = car._rotation;
skidMarksBitmap.draw(skidMarkHolder);
}
function trackCollision(car) {
var _local3 = getHitPoints(car);
var _local1 = new Array(false, false, false, false);
if (!track.hitTest(_local3[0].x, _local3[0].y, true)) {
_local1[0] = true;
}
if (!track.hitTest(_local3[1].x, _local3[1].y, true)) {
_local1[1] = true;
}
if (_local1[0] && (_local1[1])) {
car.speed = car.speed * 0.9;
sfxDirtTerrain.setVolume(100);
} else if (_local1[0]) {
car.speed = car.speed * 0.95;
sfxDirtTerrain.setVolume(75);
} else if (_local1[1]) {
car.speed = car.speed * 0.95;
sfxDirtTerrain.setVolume(75);
}
_local1[0] = false;
_local1[1] = false;
if (!edge.hitTest(_local3[0].x, _local3[0].y, true)) {
_local1[0] = true;
}
if (!edge.hitTest(_local3[1].x, _local3[1].y, true)) {
_local1[1] = true;
}
if (_local1[0] && (_local1[1])) {
car.speed = car.speed * 0.7;
car._x = car.lastPos.x;
car._y = car.lastPos.y;
} else if (_local1[0]) {
car._rotation = car._rotation + 4;
car.speed = car.speed * 0.6;
} else if (_local1[1]) {
car._rotation = car._rotation - 4;
car.speed = car.speed * 0.6;
}
}
function carCollision(car, enemy) {
var _local3 = getHitPoints(car);
var _local2 = new Array(false, false, false, false);
if (enemy.hitTest(_local3[0].x, _local3[0].y, true)) {
_local2[0] = true;
}
if (enemy.hitTest(_local3[1].x, _local3[1].y, true)) {
_local2[1] = true;
}
if (_local2[0] && (_local2[1])) {
car.speed = car.speed * 0.7;
car._x = car.lastPos.x;
car._y = car.lastPos.y;
} else if (_local2[0]) {
car._rotation = car._rotation + 4;
car.speed = car.speed * 0.6;
car._x = car.lastPos.x;
car._y = car.lastPos.y;
} else if (_local2[1]) {
car._rotation = car._rotation - 4;
car.speed = car.speed * 0.6;
car._x = car.lastPos.x;
car._y = car.lastPos.y;
}
}
function getHitPoints(car) {
var _local2 = new Array();
_local2.push(new Vector2D(car.hit1._x, car.hit1._y));
car.localToGlobal(_local2[0]);
_local2.push(new Vector2D(car.hit2._x, car.hit2._y));
car.localToGlobal(_local2[1]);
_local2.push(new Vector2D(car.hit3._x, car.hit3._y));
car.localToGlobal(_local2[2]);
_local2.push(new Vector2D(car.hit4._x, car.hit4._y));
car.localToGlobal(_local2[3]);
return(_local2);
}
function countLaps(car) {
if (car.nextLapMarker.hitTest(car._x, car._y, true)) {
if (car.nextLapMarker == lapMarker1) {
if ((car.currLap > 0) && (car.currLap <= totalLaps)) {
var _local4 = car.lapTimes.length;
var _local3 = 0;
var _local2 = 0;
while (_local2 < _local4) {
_local3 = _local3 + car.lapTimes[_local2];
_local2++;
}
car.addLapTime(car.raceTimer.getCurrTime() - _local3);
if (car.playerId == 1) {
updateLapTimes(lapTimes1, car.lapTimes);
} else if (car.playerId == 2) {
updateLapTimes(lapTimes2, car.lapTimes);
}
}
car.currLap++;
if (car.currLap <= totalLaps) {
car.lapCounter.text = car.currLap;
} else {
car.raceTimer.stop();
var _local5 = car.playerId;
if (_local5 != 0) {
players[car.playerId - 1].raceTime = car.raceTimer.getCurrTime();
players[car.playerId - 1].lapTimes = car.lapTimes;
}
if (car.playerId > 0) {
car.playerId = 0;
}
if (raceWinner == null) {
finishRace(_local5, car.playerName + " wins!");
} else if (_local5 > 0) {
onRaceLost();
}
}
car.setNextLapMarker(lapMarker2);
} else {
car.setNextLapMarker(lapMarker1);
}
}
}
function updateLapTimes(clip, times) {
var _local3 = times.length;
var _local4 = 0;
var _local1 = 0;
while (_local1 < _local3) {
clip["lap" + (_local1 + 1)].text = formatTime(times[_local1]);
_local4 = _local4 + times[_local1];
_local1++;
}
if (numPlayers < 2) {
updateRank(_local3, _local4);
}
}
function initRank() {
rankClip.laps.text = "0 Laps";
rankClip.rank0.text = "001";
rankClip.rank1.text = "002";
rankClip.rank2.text = "003";
rankClip.highlight0._visible = false;
rankClip.highlight1._visible = false;
rankClip.highlight2._visible = false;
}
function updateRank(laps, tTotal) {
rankClip.laps1.text = laps;
if (laps == 1) {
rankClip.laps2.text = "lap";
} else {
rankClip.laps2.text = "laps";
}
rankClip.highlight0._visible = false;
rankClip.highlight1._visible = false;
rankClip.highlight2._visible = false;
var _local3 = rankTimes.length;
var _local1 = 0;
while (_local1 < _local3) {
if (tTotal < ((rankTimes[_local1] / totalLaps) * laps)) {
if (_local1 == 0) {
rankClip.name0.text = "Player 1";
rankClip.name1.text = rankNames[0];
rankClip.name2.text = rankNames[1];
rankClip.time0.text = formatTime(tTotal);
rankClip.time1.text = formatTime((rankTimes[0] / totalLaps) * laps);
rankClip.time2.text = formatTime((rankTimes[1] / totalLaps) * laps);
rankClip.rank0.text = "001";
rankClip.rank1.text = "002";
rankClip.rank2.text = "003";
rankClip.highlight0._visible = true;
} else {
rankClip.name0.text = rankNames[_local1 - 1];
rankClip.name1.text = "Player 1";
rankClip.name2.text = rankNames[_local1];
rankClip.time0.text = formatTime((rankTimes[_local1 - 1] / totalLaps) * laps);
rankClip.time1.text = formatTime(tTotal);
rankClip.time2.text = formatTime((rankTimes[_local1] / totalLaps) * laps);
var _local4 = "";
if (_local1 < 100) {
_local4 = "0";
}
if (_local1 < 10) {
_local4 = "00";
}
rankClip.rank0.text = _local4 + _local1;
_local4 = "";
if ((_local1 + 1) < 100) {
_local4 = "0";
}
if ((_local1 + 1) < 10) {
_local4 = "00";
}
rankClip.rank1.text = _local4 + (_local1 + 1);
_local4 = "";
if ((_local1 + 2) < 100) {
_local4 = "0";
}
if ((_local1 + 2) < 10) {
_local4 = "00";
}
rankClip.rank2.text = _local4 + (_local1 + 2);
rankClip.highlight1._visible = true;
}
break;
}
if (_local1 == (_local3 - 1)) {
rankClip.name0.text = rankNames[_local3 - 2];
rankClip.name1.text = rankNames[_local3 - 1];
rankClip.name2.text = "Player 1";
rankClip.time0.text = formatTime((rankTimes[_local3 - 2] / totalLaps) * laps);
rankClip.time1.text = formatTime((rankTimes[_local3 - 1] / totalLaps) * laps);
rankClip.time2.text = formatTime(tTotal);
var _local4 = "";
if (_local1 < 100) {
_local4 = "0";
}
if (_local1 < 10) {
_local4 = "00";
}
rankClip.rank0.text = _local4 + _local1;
_local4 = "";
if ((_local1 + 1) < 100) {
_local4 = "0";
}
if ((_local1 + 1) < 10) {
_local4 = "00";
}
rankClip.rank1.text = _local4 + (_local1 + 1);
_local4 = "";
if ((_local1 + 2) < 100) {
_local4 = "0";
}
if ((_local1 + 2) < 10) {
_local4 = "00";
}
if (_local1 < 9) {
rankClip.rank2.text = _local4 + (_local1 + 2);
} else {
rankClip.rank2.text = "--";
}
rankClip.highlight2._visible = true;
break;
}
_local1++;
}
}
function formatTime(t) {
var _local1 = (t * FPS) / 100;
var _local6 = Math.floor(_local1 / (FPS * 60));
var _local7 = String(_local6);
_local1 = _local1 - (_local6 * (FPS * 60));
var _local2 = Math.floor(_local1 / FPS);
var _local4 = String(_local2);
if (_local2 < 10) {
_local4 = "0" + String(_local2);
}
_local1 = _local1 - (_local2 * FPS);
var _local3 = Math.floor((_local1 / FPS) * 100);
var _local5 = String(_local3);
if (_local3 < 10) {
_local5 = "0" + String(_local3);
}
return(String((((_local7 + ":") + _local4) + ".") + _local5));
}
function startRace() {
p1.isRacing = true;
p2.isRacing = true;
raceTimer1.start();
raceTimer2.start();
sfxDirtTerrain.setVolume(0);
sfxDirtTerrain.start(0, 99999);
sfxRaceLoop.start(0, 99999);
}
function finishRace(winner, msg) {
raceWinner = winner;
finishMessage.resultClip.msg.text = msg;
finishMessage.gotoAndPlay("on");
}
function onRaceWon() {
if (numPlayers < 2) {
if (raceWinner == 1) {
p1.soundStopAll();
p2.soundStopAll();
sfxDirtTerrain.stop();
onEnterFrame = null;
transition.gotoAndPlay("close");
transFunc = gotoResult;
}
}
}
function onRaceLost() {
clearInterval(intervalId);
intervalId = setInterval(this, "exitRace", 2000);
}
function exitRace() {
clearInterval(intervalId);
p1.soundStopAll();
p2.soundStopAll();
sfxDirtTerrain.stop();
transition.gotoAndPlay("close");
transFunc = gotoResult;
}
stop();
_parent.sfxMainLoop.stop();
controlsClip.gotoAndStop(numPlayers);
controlsClip.okButton.onRelease = function () {
controlsClip._visible = false;
startMessage.gotoAndPlay("on");
_parent.sfxClick.start();
};
var rankNames = new Array();
var rankTimes = new Array();
_parent.hiScoresInst.getScoresList(rankNames, rankTimes);
var isDebugMode = false;
var debugClip = createEmptyMovieClip("debugClip", 0);
gripUp.onRelease = function () {
if (gripVal.text < 1) {
gripVal.text = gripVal.text - -0.1;
}
p1.setGrip(Number(gripVal.text));
p2.setGrip(Number(gripVal.text));
};
gripDown.onRelease = function () {
if (gripVal.text > 0.1) {
gripVal.text = gripVal.text - 0.1;
}
p1.setGrip(Number(gripVal.text));
p2.setGrip(Number(gripVal.text));
};
accelUp.onRelease = function () {
if (accelVal.text < 1) {
accelVal.text = accelVal.text - -0.1;
}
p1.setAccel(Number(accelVal.text));
p2.setAccel(Number(accelVal.text));
};
accelDown.onRelease = function () {
if (accelVal.text > 0.1) {
accelVal.text = accelVal.text - 0.1;
}
p1.setAccel(Number(accelVal.text));
p2.setAccel(Number(accelVal.text));
};
maxUp.onRelease = function () {
if (maxVal.text < 1) {
maxVal.text = maxVal.text - -0.1;
}
p1.setMaxSpeed(Number(maxVal.text));
p2.setMaxSpeed(Number(maxVal.text));
};
maxDown.onRelease = function () {
if (maxVal.text > 0.1) {
maxVal.text = maxVal.text - 0.1;
}
p1.setMaxSpeed(Number(maxVal.text));
p2.setMaxSpeed(Number(maxVal.text));
};
var totalLaps = 3;
if (playerChar == PLAYER_PHINEUS) {
characterClip.gotoAndStop("phineus");
} else {
characterClip.gotoAndStop("ferb");
}
var p1 = carHolder.attachMovie("car", "p1", 101);
var p2 = carHolder.attachMovie("car", "p2", 102);
p1.setName("Player One");
p1.setControlKeys(P1_ACCELERATE, P1_REVERSE, P1_LEFT, P1_RIGHT, P1_BOOST);
p1.setPosition(p1Marker._x, p1Marker._y, p1Marker._rotation);
p1.resetLaps();
p1.setNextLapMarker(lapMarker1);
p1.setLapCounter(lapCount1);
p1.setTimer(raceTimer1);
p1.setBoostBar(boost1);
p1.setVehicleSounds(sfxCarIdle, sfxCarFlatOut, sfxCarIncrease, sfxCarDecrease, sfxBoost);
p1.setSkidSounds(new Array(sfxSkid1, sfxSkid2, sfxSkid3));
p1.setGrip(players[0].grip / 10);
p1.setAccel((players[0].accel + 2) / 10);
p1.setMaxSpeed((players[0].maxSpeed + 2) / 10);
trace("Grip:" + ((players[0].grip + 1) / 10));
trace("Accel:" + ((players[0].accel + 2) / 10));
trace("Max:" + ((players[0].maxSpeed + 2) / 10));
p1.setCustomCar(players[0].parts);
p2.setName("Player Two");
p2.setControlKeys(P2_ACCELERATE, P2_REVERSE, P2_LEFT, P2_RIGHT, P2_BOOST);
p2.setPosition(p2Marker._x, p2Marker._y, p2Marker._rotation);
p2.resetLaps();
p2.setNextLapMarker(lapMarker1);
p2.setLapCounter(lapCount2);
p2.setTimer(raceTimer2);
p2.setBoostBar(boost2);
if (numPlayers < 2) {
if (players[0].parts[1] == 2) {
players[1].parts[1] = 1;
players[1].parts[3] = 6;
} else {
players[1].parts[1] = 2;
players[1].parts[3] = 7;
}
}
p2.setCustomCar(players[1].parts);
p1.setPlayer(1);
if (numPlayers > 1) {
p2.setPlayer(2);
labelCPU._visible = false;
p2.setGrip(players[0].grip / 10);
p2.setAccel((players[0].accel + 4) / 10);
p2.setMaxSpeed((players[0].maxSpeed + 2) / 10);
} else {
label2UP._visible = false;
p2.setGrip(players[1].grip + 0.1);
p2.setAccel((players[1].accel + 2) / 10);
p2.setMaxSpeed((players[1].maxSpeed + 2) / 10);
}
if (p2.playerId == 0) {
lapTimes2._visible = false;
initRank();
} else {
rankClip._visible = false;
}
var shadow1 = carHolder.attachMovie("shadow", "shadow1", 1);
var shadow2 = carHolder.attachMovie("shadow", "shadow2", 2);
updateShadows();
startMessage.gotoAndPlay("on");
var raceWinner = null;
var waypoints = new Array();
waypoints.push(w0);
waypoints.push(w1);
waypoints.push(w2);
waypoints.push(w3);
waypoints.push(w4);
waypoints.push(w5);
waypoints.push(w6);
waypoints.push(w7);
waypoints.push(w8);
waypoints.push(w9);
waypoints.push(w10);
waypoints.push(w11);
waypoints.push(w12);
waypoints.push(w13);
waypoints.push(w14);
waypoints.push(w15);
waypoints.push(w16);
waypoints.push(w17);
waypoints.push(w18);
waypoints.push(w19);
waypoints.push(w20);
waypoints.push(w21);
waypoints.push(w22);
waypoints.push(w23);
var skidMarksBitmap = (new flash.display.BitmapData(640, 480, true, 16777215));
skidMarkBitmapHolder.attachBitmap(skidMarksBitmap, 1);
var skid1 = skidMarkHolder.attachMovie("skid", "skid1", 1);
var skid2 = skidMarkHolder.attachMovie("skid", "skid2", 2);
p1.setSkidmarks(skid1);
p2.setSkidmarks(skid2);
var intervalId = 0;
onEnterFrame = function () {
p1.update();
p2.update();
cpuUpdate(p1);
cpuUpdate(p2);
sfxDirtTerrain.setVolume(0);
trackCollision(p1);
trackCollision(p2);
carCollision(p1, p2);
carCollision(p2, p1);
countLaps(p1);
countLaps(p2);
updateShadows();
updateSkidMarks(p1);
updateSkidMarks(p2);
};
Symbol 1037 MovieClip Frame 16
function printResult() {
var _local2 = new PrintJob();
if (_local2.start()) {
var _local3 = false;
if (_local2.orientation == "portrait") {
printout._visible = true;
_local3 = _local2.addPage(this, {xMin:640, xMax:1240, yMin:0, yMax:800}, {printAsBitmap:true});
} else {
printout._rotation = 270;
printout._y = 596;
printout._visible = true;
_local3 = _local2.addPage(this, {xMin:640, xMax:1440, yMin:0, yMax:600}, {printAsBitmap:true});
}
if (_local3) {
_local2.send();
printout._visible = false;
}
}
}
stop();
sfxRaceLoop.stop();
_parent.sfxMainLoop.setVolume(50);
_parent.sfxMainLoop.start(0, 99999);
var bestLap;
var isWinner;
var challengeScore;
if (raceWinner == 0) {
finishCar.wheels.gotoAndStop(players[0].parts[PART_WHEELS]);
finishCar.chasis.gotoAndStop(players[0].parts[PART_CHASIS]);
finishCar.back.gotoAndStop(players[0].parts[PART_CHASIS]);
finishCar.bodykit.gotoAndStop(players[0].parts[PART_BODYKIT]);
finishCar.decals.gotoAndStop(players[0].parts[PART_DECALS]);
raceTime.text = formatTime(players[0].raceTime);
challengeScore = formatTime(players[0].raceTime);
_parent.setRaceScore(players[0].raceTime);
bestLap = Math.min(players[0].lapTimes[0], players[0].lapTimes[1]);
bestLap = Math.min(bestLap, players[0].lapTimes[2]);
lapTime.text = formatTime(bestLap);
isWinner = false;
resultClip.gotoAndStop("lose");
currPlayer = 0;
} else {
finishCar.wheels.gotoAndStop(players[raceWinner - 1].parts[PART_WHEELS]);
finishCar.chasis.gotoAndStop(players[raceWinner - 1].parts[PART_CHASIS]);
finishCar.back.gotoAndStop(players[raceWinner - 1].parts[PART_CHASIS]);
finishCar.bodykit.gotoAndStop(players[raceWinner - 1].parts[PART_BODYKIT]);
finishCar.decals.gotoAndStop(players[raceWinner - 1].parts[PART_DECALS]);
raceTime.text = formatTime(players[raceWinner - 1].raceTime);
challengeScore = formatTime(players[raceWinner - 1].raceTime);
_parent.setRaceScore(players[raceWinner - 1].raceTime);
bestLap = Math.min(players[raceWinner - 1].lapTimes[0], players[raceWinner - 1].lapTimes[1]);
bestLap = Math.min(bestLap, players[raceWinner - 1].lapTimes[2]);
lapTime.text = formatTime(bestLap);
isWinner = true;
if (raceWinner == 1) {
resultClip.gotoAndStop("p1 win");
} else {
resultClip.gotoAndStop("p2 win");
}
currPlayer = raceWinner - 1;
resultClip.carName.text = players[currPlayer].carName + " wins!";
}
printout._visible = false;
printButton.onRelease = function () {
printout.car.wheels.gotoAndStop(players[currPlayer].parts[PART_WHEELS]);
printout.car.chasis.gotoAndStop(players[currPlayer].parts[PART_CHASIS]);
printout.car.back.gotoAndStop(players[currPlayer].parts[PART_CHASIS]);
printout.car.bodykit.gotoAndStop(players[currPlayer].parts[PART_BODYKIT]);
printout.car.decals.gotoAndStop(players[currPlayer].parts[PART_DECALS]);
printout.carName.text = players[currPlayer].carName;
printout.statMax.gotoAndStop(Math.round(players[currPlayer].maxSpeed));
printout.statGrip.gotoAndStop(Math.round(players[currPlayer].grip));
printout.statAccel.gotoAndStop(Math.round(players[currPlayer].accel));
printout.statStyle.gotoAndStop(players[currPlayer].style);
printout.raceTime.text = formatTime(players[currPlayer].raceTime);
printout.lapTime.text = formatTime(bestLap);
if (isWinner) {
printout.rankClip.gotoAndStop(1);
} else {
printout.rankClip.gotoAndStop(2);
}
printResult();
_parent.sfxClick.start();
};
challengeBox.gotoAndStop("input");
challengeBox._visible = false;
challengeButton.onRelease = function () {
challengeBox.gotoAndStop("input");
challengeBox._visible = true;
cancelButton._visible = true;
printButton._visible = false;
challengeButton._visible = false;
continueButton._visible = false;
_parent.sfxClick.start();
};
cancelButton._visible = false;
cancelButton.onRelease = function () {
cancelButton._visible = false;
challengeBox._visible = false;
printButton._visible = true;
challengeButton._visible = true;
continueButton._visible = true;
_parent.sfxClick.start();
};
continueButton.onRelease = function () {
printButton.enabled = false;
challengeButton.enabled = false;
continueButton.enabled = false;
_parent.play();
_parent.sfxClick.start();
};