Frame 1
stop();
timeVar = getTimer();
Frame 2
stop();
newMess.unloadMovie();
quiz_window.unloadMovie();
var practice = true;
function updateData(which) {
if (dataOn == false) {
return(undefined);
}
var dataSend = new LoadVars();
switch (which) {
case "enter" :
dataSend.milsecs = getTimer() - timeVar;
break;
case "alldone" :
dataSend.score = ototal;
break;
case "shots" :
case "info" :
dataSend.hole = curHole + 1;
break;
case "qtry" :
dataSend.question = quiz_complete + 1;
break;
case "selecthole" :
if (quiz_started == true) {
dataSend.started = 1;
}
break;
case "exit" :
if (updateActiveTime == true) {
updateActiveTime = false;
totalActiveTime = totalActiveTime + 30;
}
dataSend.totalActive = totalActiveTime;
}
dataSend.action = which;
dataSend.userid = userid;
dataSend.sendAndLoad(usagephp, dataLoad, "POST");
}
var dataOn = true;
var dataLoad = new LoadVars();
var userid = 0;
var dataInit = false;
var usagephp = "data/minigolfData.php";
var totalActiveTime = 0;
var updateActiveTime = false;
dataLoad.onLoad = function () {
if (dataInit == false) {
userid = dataLoad.userid;
timeoutid = setInterval(updateData, 30000, "exit");
dataInit = true;
}
};
updateData("enter");
function buttonTimer() {
clearInterval(buttonTimerID);
var tLength = touchArray.length;
var tempLength = tempTouch.length;
var hit = false;
var n = 0;
while (n < tempLength) {
if (tempTouch[n].hitTest(_xmouse, _ymouse, true)) {
applyFunction(true, tempTouch[n].name, tempTouch[n].param1, tempTouch[n].param2);
hit = true;
break;
}
n++;
}
if (hit != true) {
var i = 0;
while (i < tLength) {
if (touchArray[i].hitTest(_xmouse, _ymouse, true)) {
applyFunction(true, touchArray[i].name, touchArray[i].param1, touchArray[i].param2);
}
i++;
}
}
}
function applyFunction(touch, name, param1, param2) {
if (((touchScreen == true) && (touch == true)) || ((touchScreen != true) && (touch != true))) {
switch (name) {
case "play" :
updateData("go");
gotoAndStop (12);
return;
case "instructions" :
gotoAndStop (7);
return;
case "intro" :
gotoAndStop (2);
return;
case "startLaunch" :
grid.startLauncher();
return;
case "clearParts" :
grid.clearParts();
return;
case "selectHole" :
updateData("selecthole");
curHole = param1;
setHole();
return;
case "nextHole" :
trace("what the?");
ishole = getNextHole();
if (ishole == true) {
setHole();
} else {
gotoAndStop (17);
}
return;
case "setHole" :
if (param1 == true) {
setHole();
} else {
gotoAndStop (17);
}
return;
case "replay" :
curHole = param1;
setHole();
return;
case "info" :
infoClick(param1);
return;
case "closeWindow" :
simPaused = false;
trace(newMess);
newMess.unloadMovie();
return;
case "introClose" :
newMess.unloadMovie();
setHole();
case "dragZoom" :
if (simPaused != true) {
param1.startDrag(false, -55, 0, 55, 0);
}
return;
case "dragValue" :
param1.startDrag(false, 0, 0, 100, 0);
return;
case "setValues" :
updateData("stormslider");
param1.handler.saveValue();
grid.clearFields();
grid.clearParts();
drawfield._visible = true;
drawID = setInterval(drawseq, 30);
return;
case "beginQuiz" :
quiz_started = true;
updateData("quizStarted");
param1.gotoAndStop("main");
return;
case "quizAnswer" :
param1.answerClick(param2);
return;
case "tryAgain" :
param1.gotoAndStop("main");
return;
case "quizMe" :
quizMe();
return;
case "quizDone" :
quiz_done = true;
quizMe();
return;
case "restart" :
newMess = messages.attachMovie("reset cover", "newMess", 1);
return;
case "dorestart" :
updateData("restart");
updateData("exit");
newMess.unloadMovie();
gotoAndStop (1);
case "help" :
updateData("instructions");
newMess = messages.attachMovie("help window", "newMess", 1);
return;
case "enterName" :
nameCheck();
}
}
}
touchScreen = false;
touchArray = new Array(playTouch, instrTouch, homeTouch);
this.onMouseDown = function () {
updateActiveTime = true;
clearInterval(buttonTimerID);
buttonTimerID = setInterval(buttonTimer, 20);
};
Instance of Symbol 20 MovieClip "playTouch" in Frame 2
//component parameters
onClipEvent (initialize) {
name = "instructions";
}
Instance of Symbol 193 MovieClip "diag" in Frame 2
onClipEvent (load) {
this._visible = false;
}
onClipEvent (keyDown) {
trace("hello");
if (Key.isDown(36)) {
if (this._visible == true) {
this._visible = false;
} else {
this._visible = true;
}
}
}
Frame 7
touchArray = new Array(playTouch, homeTouch);
Instance of Symbol 20 MovieClip "playTouch" in Frame 7
//component parameters
onClipEvent (initialize) {
name = "play";
}
Instance of Symbol 125 MovieClip in Frame 7
onClipEvent (load) {
var nSound = new Sound(this);
nSound.setVolume(0);
}
Frame 12
function tanh(x) {
var a = Math.exp(x);
var b = Math.exp(-x);
return((a - b) / (a + b));
}
function setTerminators() {
xterminator = xsize / pixelStep;
yterminator = ysize / pixelStep;
lLimit = (-xterminator) / lTerm;
tLimit = (-yterminator) / 2;
rLimit = xterminator / rTerm;
bLimit = yterminator / 2;
}
var xsize = 400;
var ysize = 200;
var pixelStep = 10;
var initPixelStep = 10;
var initEarthScale = 6;
var particleNum = 0;
var launches = 0;
var score = 0;
timestep = 0.05;
newscoret = "even";
Bx0 = 0;
By0 = 0;
a = 1;
Ez = 0;
var simPaused = true;
var thisPart = null;
this.onEnterFrame = function () {
if (thisPart != null) {
showthis = thisPart.Ep;
}
};
var lTerm = 2;
var rTerm = 2;
setTerminators();
touchArray = new Array(clearTouch, restartTouch, helpTouch, zoomSlider.slider.zoomTouch, practiceStuff.nextTouch, fieldTouch);
function quizMe() {
trace("quizme");
if (quiz_done == true) {
setHole();
} else {
simPaused = true;
quiz_window = messages.attachMovie("quiz", "quiz_window", 1);
quiz_window.quiz = quiz_array[quiz_complete];
}
}
var quiz_complete = 0;
var quiz_guesses = 0;
var quiz_done = false;
var quiz_array = new Array();
var quiz_answers = new Array();
quiz_answers.push({answer:"It ignores the field and moves in a straight line", correct:false});
quiz_answers.push({answer:"It speeds up.", correct:false});
quiz_answers.push({answer:"It circles the field line while moving along it.", correct:true});
quiz_array.push({question:"How does a proton move when there is a magnetic field present?", wrong:"Try hole number 2 to find out the answer", right:"", answers:quiz_answers});
var quiz_answers = new Array();
quiz_answers.push({answer:"It can just do it at random.", correct:false});
quiz_answers.push({answer:"A magnetic field that gets stronger (field lines that pinch together).", correct:true});
quiz_answers.push({answer:"Hitting the Earth.", correct:false});
quiz_array.push({question:"What can make a charged particle mirror (bounce back)?", wrong:"Try hole number 5 to find out the answer", right:"", answers:quiz_answers});
var quiz_answers = new Array();
quiz_answers.push({answer:"Yes: it can always cross the field line.", correct:false});
quiz_answers.push({answer:"Yes: an electric field can make it drift.", correct:true});
quiz_answers.push({answer:"No: it always moves along the field line.", correct:false});
quiz_array.push({question:"Can a charged particle ever cross a field line?", wrong:"Try hole number 4 to find out the answer", right:"", answers:quiz_answers});
var quiz_answers = new Array();
quiz_answers.push({answer:"Its speed along the field.", correct:false});
quiz_answers.push({answer:"The size of its orbit around the field.", correct:false});
quiz_answers.push({answer:"Neither.", correct:true});
quiz_array.push({question:"When you have a crossed electric and magnetic field, the speed a particle drifts across the magnetic field (down, in our case) is controlled by:", wrong:"", right:"The speed of the particle doesn\u2019t matter at all: it\u2019s controlled by the strength of the electric and magnetic fields.", answers:quiz_answers});
var quiz_answers = new Array();
quiz_answers.push({answer:"Directly along the field.", correct:true});
quiz_answers.push({answer:"Directly away from the field.", correct:false});
quiz_answers.push({answer:"It doesn't matter: it can't get out.", correct:false});
quiz_array.push({question:"If you want to get a particle through a pinched field, it\u2019s best to start it:", wrong:"Try hole number 4 to find out the answer", right:"Magnetic bottles like these may some day be used to harness plasma fusion for energy.", answers:quiz_answers});
var quiz_answers = new Array();
quiz_answers.push({answer:"The polar regions.", correct:true});
quiz_answers.push({answer:"The equatorial region.", correct:false});
quiz_answers.push({answer:"Anywhere.", correct:false});
quiz_array.push({question:"When particles get all the way to the Earth, where do they generally end up?", wrong:"Try hole number 8 to find out the answer", right:"This is why we have aurora near the poles: particles streaming in along the field lines excite atoms in the atmosphere.", answers:quiz_answers});
var quiz_answers = new Array();
quiz_answers.push({answer:"They shoot directly in from the Sun.", correct:false});
quiz_answers.push({answer:"They drift across field lines then move toward the poles.", correct:true});
quiz_answers.push({answer:"They don't get to Earth at all.", correct:false});
quiz_array.push({question:"How do particles generally get from the Sun to Earth?", wrong:"Try hole number 9 to find out the answer", right:"What particles do get here from the sun arrive from the tail after drifting across the field. But mostly our magnetosphere shields us from solar particles.", answers:quiz_answers});
function setHole() {
tempTouch = Array();
if (holes[curHole].done == true) {
practiceStuff.gotoAndStop("show");
updateData("replay");
var holesdone = true;
var i = 0;
while (i < holes.length) {
if (holes[i].done != true) {
holesdone = false;
}
i++;
}
practiceStuff.buttonText.text = ((holesdone == true) ? "clubhouse" : "next hole");
} else {
practiceStuff.gotoAndStop("hide");
}
if (holes[curHole].field == "dipole") {
initEarthScale = 10;
} else {
initEarthScale = 6;
}
editfield._visible = ((curHole < (holes.length - 1)) ? false : true);
grid.elecfield._visible = holes[curHole].elec;
grid.elecfield._alpha = ((curHole < (holes.length - 1)) ? 45 : 0);
grid.waveLines = Array();
pixelStep = initPixelStep;
grid.clearParts();
newMess.unloadMovie();
scorehole.highlight._visible = false;
scorehole.scoreButton.enabled = true;
scorehole = scoreHoles[curHole];
scorehole.highlight._visible = true;
scorehole.scoreButton.enabled = false;
curHoleObject = holes[curHole];
infoHolder = grid.attachMovie("info holder", "infoHolder", 1);
infoHolder.infos = curHoleObject.infos;
infoHolder.par = curHoleObject.par;
cloudHolder = grid.attachMovie("cloud holder", "cloudHolder", 3);
cloudHolder.clouds = curHoleObject.clouds;
if ((curHole == 9) && (quiz_done != true)) {
textarea.descr.gotoAndStop("quiz");
} else {
textarea.showDescr(curHole + 1);
}
sizeHole();
setTeeboxes();
if ((curHole == 9) && (quiz_done != true)) {
quizMe();
} else {
quiz_window.unloadMovie();
zoomSlider.slider._x = 0;
grid.particleClip.earth._xscale = initEarthScale;
grid.particleClip.earth._yscale = initEarthScale;
grid.clearFields();
field = curHoleObject.field;
method = curHoleObject.method;
lTerm = curHoleObject.lLimit;
rTerm = curHoleObject.rLimit;
setTerminators();
earthOffset = ((lLimit + rLimit) * pixelStep) / 2;
grid._x = gridx - earthOffset;
if (field != "none") {
drawfield._visible = true;
drawID = setInterval(drawseq, 30);
} else {
simPaused = false;
}
}
}
function drawseq() {
updateAfterEvent();
grid.drawField();
clearInterval(drawID);
}
function sizeHole() {
grid.hole.gotoAndStop(1);
grid.hole._xscale = 100;
grid.hole._yscale = 100;
grid.hole._x = curHoleObject.x * pixelStep;
grid.hole._y = curHoleObject.y * pixelStep;
grid.flag._x = grid.hole._x;
grid.flag._y = grid.hole._y;
grid.hole._width = curHoleObject.hwidth * pixelStep;
grid.hole._height = curHoleObject.hheight * pixelStep;
grid.particleClip.earth._visible = holes[curHole].earth;
}
function setTeeboxes() {
var teeboxes = holes[curHole].teeboxes;
i = 0;
while (i < teeboxes.length) {
curClip = eval (("this.grid." + teeboxes[i].level) + "tee");
curClip._rotation = 0;
curClip._x = teeboxes[i].x * pixelStep;
curClip._y = teeboxes[i].y * pixelStep;
curClip._width = teeboxes[i].bwidth * pixelStep;
curClip._height = teeboxes[i].bheight * pixelStep;
curClip._rotation = teeboxes[i].rotation;
curClip.level = teeboxes[i].level;
curName = eval (("this.grid." + teeboxes[i].level) + "tee name");
curName._x = curClip._x;
curName._y = curClip._y - (curClip._height / 2);
i++;
}
grid.infoHolder.setInfos();
}
var curHole = 0;
var curHoleObject = new Object();
var scorehole = null;
var method = "";
var field = "";
var holenum = 0;
var gridx = grid._x;
var infoArray = new Array();
var holes = new Array();
var teeboxes = new Array({level:"hard", x:8, y:5, bwidth:2, bheight:3, rotation:45});
var infos = new Array({id:1, x:10, y:8});
var clouds = new Array();
holes.push({par:2, teeboxes:teeboxes, infos:infos, clouds:clouds, x:-8, y:-5, hwidth:2, hheight:2, method:"real time", field:"none", earth:false, done:false, lLimit:2, rLimit:2, elec:false, expl:"Good job! Now watch what happens on the next hole, where there's a magnetic field to guide the protons."});
var teeboxes = new Array({level:"hard", x:-15, y:0, bwidth:2, bheight:3, rotation:0});
var infos = new Array({id:2, x:0, y:2});
holes.push({par:1, teeboxes:teeboxes, infos:infos, clouds:clouds, x:15, y:0, hwidth:1.5, hheight:1.5, method:"real time", field:"horizontal", earth:false, done:false, lLimit:2, rLimit:2, elec:false, expl:"Great! In this case the field guided the proton right to the hole. Next, try a hole that isn't quite lined up."});
var teeboxes = new Array({level:"hard", x:18, y:-1, bwidth:2, bheight:1.5, rotation:0});
var infos = new Array({id:10, x:5, y:-5});
var clouds = new Array();
holes.push({par:2, teeboxes:teeboxes, infos:infos, x:-10, y:-2.7, hwidth:1.9, hheight:1.9, method:"real time", field:"horizontal", earth:false, done:false, lLimit:2, rLimit:2, elec:false, expl:"Congratulations! The protons orbit around the field line, and shooting almost straight up or down makes that orbit as big as possible. Next we add an electric field: they make protons drift across the field lines."});
var teeboxes = new Array({level:"hard", x:15, y:-6, bwidth:1.5, bheight:2, rotation:-45});
var infos = new Array({id:9, x:-2, y:-1.5});
var clouds = new Array();
holes.push({par:3, teeboxes:teeboxes, infos:infos, clouds:clouds, x:-15, y:6, hwidth:2, hheight:2, method:"real time", field:"horizelec", earth:false, done:false, lLimit:2, rLimit:2, elec:true, expl:"Excellent! That electric field created a constant downward drift: added to the motion you gave the proton along the field, it let you get to the hole."});
var teeboxes = new Array({level:"hard", x:-5, y:0.6, bwidth:1, bheight:2, rotation:0});
var infos = new Array({id:3, x:10, y:0});
var clouds = new Array();
holes.push({par:2, teeboxes:teeboxes, infos:infos, clouds:clouds, x:19, y:0, hwidth:1.5, hheight:1.5, method:"real time", field:"pinched", earth:false, done:false, lLimit:2, rLimit:2, elec:false, expl:"Good Job! Pinched fields like this slow down charged particles, trading their motion along the field for motion orbiting around it. If particles start off almost parallel to the field, they'll go farther. "});
var teeboxes = new Array({level:"hard", x:15, y:0, bwidth:1.5, bheight:1.5, rotation:0});
var infos = new Array({id:4, x:0, y:3});
var clouds = new Array();
holes.push({par:3, teeboxes:teeboxes, infos:infos, clouds:clouds, x:1, y:-2, hwidth:1.5, hheight:1.5, method:"real time", field:"dipole", earth:true, done:false, lLimit:2, rLimit:2, elec:false, expl:"Great! Earth's magnetic field acts like the pinched field on the last hole, bouncing particles from pole to pole. Only some manage to get to Earth in the polar regions."});
var teeboxes = new Array({level:"hard", x:20, y:0, bwidth:2, bheight:2, rotation:0});
var infos = new Array({id:5, x:15, y:0});
var clouds = new Array();
holes.push({par:4, teeboxes:teeboxes, infos:infos, clouds:clouds, x:6, y:0, hwidth:1.5, hheight:1.5, method:"real time", field:"tail", earth:true, done:false, lLimit:4, rLimit:1.33333333333333, elec:true, expl:"Terrific! In our magnetic tail, particles don't just shoot along field lines to Earth. The electric field speeds up particles and drifts them toward Earth. It takes more time, but they get there eventually."});
var teeboxes = new Array({level:"hard", x:24, y:-6, bwidth:2, bheight:1, rotation:0});
var infos = new Array({id:6, x:27, y:-6});
var clouds = new Array();
holes.push({par:4, teeboxes:teeboxes, infos:infos, clouds:clouds, x:6, y:0, hwidth:1.5, hheight:1.5, method:"real time", field:"tail", earth:true, done:false, lLimit:4, rLimit:1.33333333333333, elec:true, expl:"Great job! It takes even longer than the last hole, but particles from the sun can follow this kind of path. They slowly drift toward the tail, then pick up speed and drift Earthward."});
var teeboxes = new Array({level:"hard", x:25, y:1, bwidth:2, bheight:1, rotation:0});
var infos = new Array({id:11, x:3, y:-1.5});
var clouds = new Array({x:4.2, y:-2.5, r:1.5}, {x:4.2, y:2.5, r:1.5});
holes.push({par:5, teeboxes:teeboxes, infos:infos, clouds:clouds, x:0, y:-1.2, hwidth:1.5, hheight:1.5, method:"real time", field:"tail", earth:true, done:false, lLimit:4, rLimit:1.33333333333333, elec:true, expl:"Excellent! The waves in the magnetic field keeps particles from bouncing indefinitely. They can knock the particles into Earth's polar regions."});
var teeboxes = new Array({level:"hard", x:25, y:3, clouds:clouds, bwidth:2, bheight:1, rotation:0});
var infos = new Array({id:12, x:22, y:7});
var clouds = new Array({x:4.2, y:-2.5, r:1.5}, {x:4.2, y:2.5, r:1.5});
holes.push({par:5, teeboxes:teeboxes, infos:infos, clouds:clouds, x:0, y:-1.2, hwidth:1.5, hheight:1.5, method:"real time", field:"custom", earth:true, done:false, lLimit:4, rLimit:1.33333333333333, elec:true, expl:"Congratulations! Sometimes Earth's field is stretched, sometimes relaxed. The different states lead to different behavior for particles in our magnetosphere."});
var startx = -110.5;
var scoreHoles = new Array();
var n = 1;
while (n <= holes.length) {
newHole = scoresheet.hole0.duplicateMovieClip("hole" + n, n);
newHole.holetext = ((n == 10) ? "Q" : (n));
newHole.hole = n;
newHole.par = holes[n - 1].par;
scoresheet.par = parseInt(scoresheet.par) + holes[n - 1].par;
newHole._x = startx + (27 * n);
newHole.highlight._visible = false;
newHole.doneClip._visible = false;
newHole.done = false;
scoreHoles.push(newHole);
n++;
}
scoresheet.hole0.unloadMovie();
setHole();
function holeHit(level) {
simPaused = true;
grid.hole.gotoAndPlay("spin");
score = score + (scorehole.shots - scorehole.par);
if (score > 0) {
newscoret = "+" + score;
} else if (score == 0) {
newscoret = "even";
} else {
newscoret = score;
}
newMess = messages.attachMovie("level end score", "newMess", 1);
newMess.shots = scorehole.shots;
newMess.expl = holes[curHole].expl;
updateData("doneholes");
holes[curHole].done = true;
scoreHoles[curHole].doneClip._visible = true;
}
function badHit() {
if (badHitswitch != true) {
newMess = messages.attachMovie("bad hit", "newMess", 1);
simPaused = true;
badHitswitch = true;
}
}
function zoomit(zoomfactor) {
updateData("zoom");
pixelStep = initPixelStep + zoomfactor;
grid.particleClip.earth._xscale = initEarthScale + (zoomfactor * 0.5);
grid.particleClip.earth._yscale = initEarthScale + (zoomfactor * 0.5);
setTerminators();
sizeHole();
setTeeboxes();
if (field != "none") {
drawfield._visible = true;
grid.fieldClip._visible = false;
drawID2 = setInterval(drawseq2, 30);
}
}
function drawseq2() {
updateAfterEvent();
grid.clearFields(true);
clearInterval(drawID2);
}
function incrShots() {
if (holes[curHole].done != true) {
scorehole.shots++;
scoresheet.shots++;
}
}
function switchPractice() {
if (practice == false) {
practice = true;
grid.easytee._visible = false;
grid.mediumtee._visible = false;
grid.hardtee._visible = false;
} else {
practice = false;
grid.easytee._visible = true;
grid.mediumtee._visible = true;
grid.hardtee._visible = true;
}
}
function getNextHole() {
ishole = false;
var doneholes = 0;
var i = 1;
while (i < _root.holes.length) {
if ((holes[(curHole + i) % holes.length].done != true) && (((curHole + i) % holes.length) != 9)) {
curHole = (curHole + i) % holes.length;
ishole = true;
break;
}
i++;
}
var n = 0;
while (n < (_root.holes.length - 1)) {
if (holes[n].done == true) {
doneholes++;
}
n++;
}
if ((doneholes == (_root.holes.length - 1)) && (holes[_root.holes.length - 1].done != true)) {
ishole = true;
curHole = _root.holes.length - 1;
}
return(ishole);
}
function infoClick(id) {
updateData("info");
simPaused = true;
newMess = messages.attachMovie("info window", "newMess", 1);
newMess.id = id;
}
var badHitswitch = false;
switchPractice();
Instance of Symbol 20 MovieClip "clearTouch" in Frame 12
//component parameters
onClipEvent (initialize) {
name = "clearParts";
}
Instance of Symbol 20 MovieClip "helpTouch" in Frame 12
//component parameters
onClipEvent (initialize) {
name = "help";
}
Instance of Symbol 20 MovieClip "restartTouch" in Frame 12
//component parameters
onClipEvent (initialize) {
name = "restart";
}
Instance of Symbol 20 MovieClip "fieldTouch" in Frame 12
//component parameters
onClipEvent (initialize) {
name = "startLaunch";
}
Instance of Symbol 317 MovieClip "drawfield" in Frame 12
onClipEvent (load) {
this.swapDepths(3);
this._visible = false;
}
Instance of Symbol 323 MovieClip "messages" in Frame 12
onClipEvent (load) {
this.swapDepths(100);
}
Frame 17
function nameCheck() {
var checker = inputName.text.toLowerCase();
var badLength = badWords.length;
var i = 0;
while (i < badLength) {
if (checker == badWords[i]) {
inputName.text = "";
invinit.play();
break;
}
i++;
}
if (inputName.text == "") {
Selection.setFocus("inputName");
} else {
theName = inputName.text;
gotoAndStop (22);
}
}
newMess.unloadMovie();
stop();
Selection.setFocus("inputName");
var SO = SharedObject.getLocal("ppp", "/");
var highscore = SO.data.highscore;
var theName = "SSI";
var i = 0;
while (i < scoreholes.length) {
scoreHoles[i].highlight._visible = false;
scoreHoles[i].doneClip._visible = false;
scoreHoles[i].scoreButton.enabled = false;
i++;
}
if (score < highscore) {
SO.data.highscore = score;
SO.flush();
}
congrats.text = congrats.text + "\n\npress restart below to play again.";
var qtotal = (quiz_guesses - (quiz_array.length * 2));
if (qtotal > 0) {
newscoreq = "+" + qtotal;
} else if (qtotal < 0) {
newscoreq = qtotal;
} else {
newscoreq = "even";
}
var ototal = (score + qtotal);
if (ototal > 0) {
newscoreo = "+" + ototal;
} else if (ototal < 0) {
newscoreo = ototal;
} else {
newscoreo = "even";
}
updateData("alldone");
var badWords = new Array("ass", "tit", "but", "dik", "dic", "fuk", "fuc", "cum", "kkk", "azz", "asz", "azs", "sht", "fkr", "pns", "std");
myListener = new Object();
myListener.onKeyDown = function () {
if (Key.isDown(13) && (Selection.getFocus() == "_level0.inputName")) {
nameCheck();
}
};
Key.addListener(myListener);
touchArray = new Array(restartTouch);
Frame 22
function addNametoDB() {
var sendName = new LoadVars();
sendName.action = "addName";
sendName.name = theName;
sendName.score = ototal;
sendName.sendAndLoad("scores/minigolf.php", getPos, "POST");
}
var getPos = new LoadVars();
var plusEnd = "";
getPos.onLoad = function () {
plusEnd = ((("Your " + newscoreo) + " score has placed you in position number ") + getPos.thepos) + " of all time.\n\n";
gotoAndStop (27);
};
addNametoDB();
Frame 27
endText.text = plusEnd + endText.text;
Symbol 7 MovieClip Frame 1
stop();
Symbol 8 MovieClip [particle] Frame 1
var point = new Object();
var incloud = false;
var fObj = new Object();
var Emax = 70;
_root.thisPart = this;
_root.updateData("shots");
if ((level != "none") && (_root.holes[_root.curHole].done != true)) {
_root.grid.infoHolder.updateInfos();
}
this.onEnterFrame = function () {
if (_root.simPaused == true) {
return(undefined);
}
if ((((x <= (_root.lLimit * 2)) || (y <= (_root.tLimit * 2))) || (x > (_root.rLimit * 2))) || (y > (_root.bLimit * 2))) {
this.unloadMovie();
} else {
if ((_parent.earth._visible == true) && (Math.pow(_parent.earth._width / 2, 2) >= ((Math.pow(x * _root.pixelStep, 2) + Math.pow(y * _root.pixelStep, 2)) + Math.pow(z * _root.pixelStep, 2)))) {
_parent.earth.makeAurora(y);
this.unloadMovie();
}
point.x = this._x;
point.y = this._y;
_parent.localToGlobal(point);
if (_parent._parent.hole.hitTest(point.x, point.y, true)) {
if (_root.holes[_root.curHole].field == "dipole") {
_parent.earth.makeAurora(-1);
}
if ((level != "none") && (_root.holes[_root.curHole].done != true)) {
_root.holeHit(this.level);
} else {
_root.badHit();
}
_root.grid.hole.gotoAndPlay("spin");
this.unloadMovie();
}
n = 0;
while (n < 5) {
switch (_root.method) {
case "real time" :
switch (_root.field) {
case "dipole" :
fObj = _parent._parent.getDipoleField(x, y, z);
break;
case "tail" :
fObj = _parent._parent.getMagnetotail(x, y, z);
break;
case "horizontal" :
fObj = _parent._parent.getHorizontalField(x, y, z);
break;
case "horizelec" :
fObj = _parent._parent.getHorizontalElecField(x, y, z);
break;
case "pinched" :
fObj = _parent._parent.getPinchedField(x, y, z);
break;
case "magic" :
fObj = _parent._parent.getMagicField(x, y, z);
break;
case "custom" :
fObj = _parent._parent.getCustomField(x, y, z);
break;
case "blank" :
fObj = _parent._parent.getBlankField(x, y, z);
}
break;
case "use array" :
fObj = _parent._parent.getFieldFromArray(x, y, z);
}
Vx1 = Vx + fObj.Ex;
Vy1 = Vy + fObj.Ey;
Vz1 = Vz + fObj.Ez;
Vx2 = Vx1 + ((Vy1 * fObj.Bz) - (Vz1 * fObj.By));
Vy2 = Vy1 + ((Vz1 * fObj.Bx) - (Vx1 * fObj.Bz));
Vz2 = Vz1 + ((Vx1 * fObj.By) - (Vy1 * fObj.Bx));
c = 2 / (((1 + Math.pow(fObj.Bx, 2)) + Math.pow(fObj.By, 2)) + Math.pow(fObj.Bz, 2));
Vx = (Vx1 + (c * ((Vy2 * fObj.Bz) - (Vz2 * fObj.By)))) + fObj.Ex;
Vy = (Vy1 + (c * ((Vz2 * fObj.Bx) - (Vx2 * fObj.Bz)))) + fObj.Ey;
Vz = (Vz1 + (c * ((Vx2 * fObj.By) - (Vy2 * fObj.Bx)))) + fObj.Ez;
if (_parent._parent.wave == true) {
cloudArray = _root.curHoleObject.clouds;
var hitCloud = false;
var i = 0;
while (i < cloudArray.length) {
if (Math.pow(cloudArray[i].r, 2) > (Math.pow(x - cloudArray[i].x, 2) + Math.pow(y - cloudArray[i].y, 2))) {
hitCloud = true;
break;
}
i++;
}
if (hitCloud == true) {
if (incloud != true) {
trace("doing it");
vmag = Math.sqrt(((Vx * Vx) + (Vy * Vy)) + (Vz * Vz));
bmag = Math.sqrt(((fObj.Bx * fObj.Bx) + (fObj.By * fObj.By)) + (fObj.Bz * fObj.Bz));
bdotv = ((fObj.Bx * Vx) + (fObj.By * Vy)) + (fObj.Bz * Vz);
vmag = vmag * (bdotv / Math.abs(bdotv));
Vx = (vmag * fObj.Bx) / bmag;
Vy = (vmag * fObj.By) / bmag;
Vz = (vmag * fObj.Bz) / bmag;
incloud = true;
}
} else {
incloud = false;
}
}
Ep = (Math.pow(Vx, 2) + Math.pow(Vy, 2)) + Math.pow(Vz, 2);
if (Ep > Emax) {
frac = Math.sqrt(Emax / Ep);
Vx = Vx * frac;
Vy = Vy * frac;
Vz = Vz * frac;
}
x = x + (_root.timestep * Vx);
y = y + (_root.timestep * Vy);
z = z + (_root.timestep * Vz);
n++;
}
this._x = x * _root.pixelStep;
this._y = y * _root.pixelStep;
this._xscale = (z * 3) + 100;
this._yscale = (z * 3) + 100;
depth = 10000 + Math.round(z * 100);
this.swapDepths(depth);
}
};
Symbol 9 MovieClip [launcher2] Frame 1
var distance = 0;
var angle = 0;
this.onEnterFrame = function () {
trace("whatthe");
newx = _xmouse;
distance = Math.sqrt(Math.pow(_xmouse, 2) + Math.pow(_ymouse, 2));
angle = Math.acos(_xmouse / distance);
if (_ymouse < 0) {
angle = (Math.PI*2) - angle;
}
trace("curhole:" + _root.curHole);
if (_root.curHole < 8) {
maxDist = 40;
} else {
maxDist = 10;
}
if (distance > maxDist) {
distance = maxDist;
}
line = this.createEmptyMovieClip("line", 1);
line.lineStyle(2, 16711680, 100);
line.moveTo(0, 0);
newx = distance * Math.cos(angle);
newy = distance * Math.sin(angle);
line.lineTo(newx, newy);
};
Symbol 10 MovieClip [wavy field line] Frame 1
function drawLine(m) {
var t = 0;
while (t < frames) {
if (t == m) {
fieldAr[t]._visible = true;
} else {
fieldAr[t]._visible = false;
}
t++;
}
}
pLength = points.length;
var offset = 0;
var frames = 10;
var fieldAr = new Array();
var i = 0;
while (i < frames) {
newfield = this.createEmptyMovieClip("field" + i, i);
newfield.moveTo(points[0].x * _root.pixelStep, points[0].y * _root.pixelStep);
offset = (i % (frames / 2)) / 2;
var n = 1;
while (n < pLength) {
newfield.lineStyle(0, 52479, points[n].a);
if ((Math.pow(points[n].x - points[n - 1].x, 2) + Math.pow(points[n].y - points[n - 1].y, 2)) > 0.5) {
newfield.moveTo(points[n].x * _root.pixelStep, points[n].y * _root.pixelStep);
} else {
if (i > 4) {
newOffset = (((n % 2) == 0) ? (offset * -1) : (offset));
} else {
newOffset = (((n % 2) > 0) ? (offset * -1) : (offset));
}
newfield.curveTo((((points[n].x + points[n - 1].x) / 2) * _root.pixelStep) + newOffset, (((points[n].y + points[n - 1].y) / 2) * _root.pixelStep) + newOffset, points[n].x * _root.pixelStep, points[n].y * _root.pixelStep);
}
n++;
}
newfield._visible = false;
fieldAr.push(newfield);
i++;
}
drawLine(0);
var frameNum = 0;
var curFrame = 0;
this.onEnterFrame = function () {
if ((_parent._parent._parent.wave == true) && (_root.simPaused != true)) {
if (frameNum < (frames / 2)) {
curFrame = frameNum;
} else if (frameNum < frames) {
curFrame = 9 - frameNum;
} else if (frameNum < (frames * 1.5)) {
curFrame = frameNum - 5;
} else if (frameNum < (frames * 2)) {
curFrame = 24 - frameNum;
} else {
frameNum = 0;
curFrame = 0;
}
drawLine(curFrame);
frameNum++;
}
};
Symbol 11 MovieClip [field line] Frame 1
function pickMethod(x, y, z) {
switch (_root.method) {
case "real time" :
switch (_root.field) {
case "dipole" :
fObj = _parent._parent.getDipoleField(x, y, z);
fMax = 80000 /* 0x013880 */;
fMin = 5;
break;
case "tail" :
fObj = _parent._parent.getMagnetotail(x, y, z);
fMax = 80000 /* 0x013880 */;
fMin = 16;
break;
case "horizontal" :
fObj = _parent._parent.getHorizontalField(x, y, z);
fMax = 0.1;
fMin = 0.01;
break;
case "horizelec" :
fObj = _parent._parent.getHorizontalElecField(x, y, z);
fMax = 0.1;
fMin = 0.01;
break;
case "pinched" :
fObj = _parent._parent.getPinchedField(x, y, z);
fMax = 15;
fMin = 0.72;
break;
case "magic" :
fObj = _parent._parent.getMagicField(x, y, z);
fMax = 15;
fMin = 0.72;
break;
case "custom" :
fObj = _parent._parent.getCustomField(x, y, z);
fMax = 80000 /* 0x013880 */;
fMin = 16;
break;
case "none" :
fObj = _parent._parent.getBlankField(x, y, z);
}
cloudArray = _root.curHoleObject.clouds;
var hitCloud = false;
var i = 0;
while (i < cloudArray.length) {
if (Math.pow(cloudArray[i].r, 2) > (Math.pow(x - cloudArray[i].x, 2) + Math.pow(y - cloudArray[i].y, 2))) {
hitCloud = true;
break;
}
i++;
}
fStren = Math.sqrt((Math.pow(fObj.Bx, 2) + Math.pow(fObj.By, 2)) + Math.pow(fObj.Bz, 2));
newAlpha = 50 + (((Math.log(fStren) - Math.log(fMin)) / (Math.log(fMax) - Math.log(fMin))) * 40);
if (hitCloud != true) {
newC = 52479;
newA = newAlpha;
if (exit == true) {
waveArray.push({x:x, y:y, a:newAlpha});
exit = false;
}
} else {
waveArray.push({x:x, y:y, a:newAlpha});
exit = true;
newA = 0;
}
return;
case "use array" :
fObj = _parent._parent.getFieldFromArray(x, y, z);
}
}
var x = (startx / pixelStep);
var y = (starty / pixelStep);
var z = 0;
var qual = 3;
var waveArray = new Array();
var line1 = this.createEmptyMovieClip("line1", 1);
line1.moveTo(startx, starty);
var point = new Object();
var fObj = new Object();
var hitEarth = 0;
var noarrow = true;
var earth = _root.grid.particleClip.earth;
entered = false;
while ((((x < _root.rLimit) && (y < _root.bLimit)) && (x >= _root.lLimit)) && (y >= _root.tLimit)) {
pickMethod(x, y, z);
if ((Math.pow(earth._width / 2, 2) >= ((Math.pow(x * _root.pixelStep, 2) + Math.pow(y * _root.pixelStep, 2)) + Math.pow(z * _root.pixelStep, 2))) && (earth._visible == true)) {
hitEarth++;
break;
}
Bn = Math.sqrt(Math.pow(fObj.Bx, 2) + Math.pow(fObj.By, 2)) * qual;
if (noarrow == true) {
angle = Math.atan2(fObj.By / Bn, fObj.Bx / Bn);
rot = angle * 57.2957795130823;
thearrow = this.attachMovie("arrow", "arrow", 2);
thearrow._rotation = rot - 90;
thearrow._x = startx;
thearrow._y = starty;
noarrow = false;
}
x = x + (fObj.Bx / Bn);
y = y + (fObj.By / Bn);
line1.lineStyle(0, newC, newA);
line1.lineTo(x * pixelStep, y * pixelStep);
}
line1.moveTo(startx, starty);
x = startx / pixelStep;
y = starty / pixelStep;
entered = false;
while ((((x < _root.rLimit) && (y < _root.bLimit)) && (x >= _root.lLimit)) && (y >= _root.tLimit)) {
pickMethod(x, y, z);
if ((Math.pow(earth._width / 2, 2) >= ((Math.pow(x * _root.pixelStep, 2) + Math.pow(y * _root.pixelStep, 2)) + Math.pow(z * _root.pixelStep, 2))) && (earth._visible == true)) {
hitEarth++;
break;
}
Bn = Math.sqrt(Math.pow(fObj.Bx, 2) + Math.pow(fObj.By, 2)) * qual;
x = x - (fObj.Bx / Bn);
y = y - (fObj.By / Bn);
line1.lineStyle(0, newC, newA);
line1.lineTo(x * pixelStep, y * pixelStep);
}
if (hitEarth == 1) {
if (((_root.field == "dipole") || (_root.field == "tail")) || (_root.field == "custom")) {
line1.moveTo(startx, -starty);
x = startx / pixelStep;
y = (-starty) / pixelStep;
} else if (_root.field == "horizontal") {
line1.moveTo(-startx, starty);
x = (-startx) / pixelStep;
y = starty / pixelStep;
}
entered = false;
while ((((x < _root.rLimit) && (y < _root.bLimit)) && (x >= _root.lLimit)) && (y >= _root.tLimit)) {
pickMethod(x, y, z);
if ((Math.pow(earth._width / 2, 2) >= ((Math.pow(x * _root.pixelStep, 2) + Math.pow(y * _root.pixelStep, 2)) + Math.pow(z * _root.pixelStep, 2))) && (earth._visible == true)) {
break;
}
Bn = Math.sqrt(Math.pow(fObj.Bx, 2) + Math.pow(fObj.By, 2)) * qual;
x = x - (fObj.Bx / Bn);
y = y - (fObj.By / Bn);
line1.lineStyle(0, newC, newA);
line1.lineTo(x * _root.pixelStep, y * _root.pixelStep);
}
if (((_root.field == "dipole") || (_root.field == "tail")) || (_root.field == "custom")) {
line1.moveTo(startx, -starty);
x = startx / pixelStep;
y = (-starty) / pixelStep;
} else if (_root.field == "horizontal") {
line1.moveTo(-startx, starty);
x = (-startx) / pixelStep;
y = starty / pixelStep;
}
entered = false;
while ((((x < _root.rLimit) && (y < _root.bLimit)) && (x >= _root.lLimit)) && (y >= _root.tLimit)) {
pickMethod(x, y, z);
if ((Math.pow(earth._width / 2, 2) >= ((Math.pow(x * _root.pixelStep, 2) + Math.pow(y * _root.pixelStep, 2)) + Math.pow(z * _root.pixelStep, 2))) && (earth._visible == true)) {
break;
}
Bn = Math.sqrt(Math.pow(fObj.Bx, 2) + Math.pow(fObj.By, 2)) * qual;
x = x + (fObj.Bx / Bn);
y = y + (fObj.By / Bn);
line1.lineStyle(0, newC, newA);
line1.lineTo(x * pixelStep, y * pixelStep);
}
}
newWave = this.attachMovie("wavy field line", "newWave", 3);
newWave.points = waveArray;
_parent._parent.waveLines.push(newWave);
Symbol 25 Button
on (release) {
_root.applyFunction(false, "setHole", ishole);
}
Symbol 27 Button
on (release) {
_root.applyFunction(false, "replay", tempHole);
}
Symbol 31 MovieClip [level end score] Frame 1
var levelMult = 0;
var newtext = "";
var shots = _root.scorehole.shots;
var par = _root.scorehole.par;
if (shots < par) {
if (shots == 1) {
newtext = "Hole in one!!!";
} else if ((par - shots) == 3) {
newtext = "Albatross!";
} else if ((par - shots) == 2) {
newtext = "Eagle!";
} else if ((par - shots) == 1) {
newtext = "Birdie!";
}
_root.scorehole.shotsText.textColor = 12517376 /* 0xBF0000 */;
} else if (shots == par) {
_root.scorehole.shotsText.textColor = 0;
newtext = "Par";
} else {
_root.scorehole.shotsText.textColor = 1597393 /* 0x185FD1 */;
if ((shots - par) == 1) {
newtext = "Bogey";
} else if ((shots - par) == 2) {
newtext = "Double bogey";
} else if ((shots - par) == 3) {
newtext = "Triple bogey";
} else if ((shots - par) == 4) {
newtext = "Quadruple bogey";
} else {
newtext = (shots - par) + " shots over par";
}
}
Symbol 31 MovieClip [level end score] Frame 16
stop();
difficulty.text = ((level + " (x") + levelMult) + ")";
attempts.text = shots;
flavorText.text = newtext;
endText.text = expl;
var tempHole = _root.curHole;
var ishole = false;
ishole = _root.getNextHole();
if (ishole != true) {
buttonText.text = "clubhouse";
}
replayTouch.param1 = tempHole;
nextTouch.param1 = ishole;
_root.tempTouch.push(replayTouch, nextTouch);
Instance of Symbol 20 MovieClip "replayTouch" in Symbol 31 MovieClip [level end score] Frame 16
//component parameters
onClipEvent (initialize) {
name = "replay";
}
Instance of Symbol 20 MovieClip "nextTouch" in Symbol 31 MovieClip [level end score] Frame 16
//component parameters
onClipEvent (initialize) {
name = "setHole";
}
Symbol 34 MovieClip [launcher] Frame 1
var distance = 0;
var angle = 0;
graphic._visible = false;
this.onEnterFrame = function () {
newx = _xmouse;
distance = Math.sqrt(Math.pow(_xmouse, 2) + Math.pow(_ymouse, 2));
angle = Math.acos(_xmouse / distance);
if (_ymouse < 0) {
angle = (Math.PI*2) - angle;
}
if (_root.curHole < 8) {
maxDist = 40;
} else {
maxDist = 20;
}
if (distance > maxDist) {
distance = maxDist;
}
if (distance > 0) {
graphic._visible = true;
}
graphic._rotation = (angle * 57.2957795130823) - 90;
line = this.createEmptyMovieClip("line", 1);
line.lineStyle(2, 16711680, 100);
line.moveTo(0, 0);
newx = distance * Math.cos(angle);
newy = distance * Math.sin(angle);
line.lineTo(newx, newy);
};
Symbol 39 Button
on (release) {
_root.applyFunction(false, "closeWindow");
}
Symbol 40 MovieClip [bad hit] Frame 1
_root.tempTouch.push(closeTouch);
Instance of Symbol 20 MovieClip "closeTouch" in Symbol 40 MovieClip [bad hit] Frame 1
//component parameters
onClipEvent (initialize) {
name = "closeWindow";
}
Symbol 42 MovieClip [shootfromhere] Frame 1
_root.tempTouch.push(closeTouch);
Instance of Symbol 20 MovieClip "closeTouch" in Symbol 42 MovieClip [shootfromhere] Frame 1
//component parameters
onClipEvent (initialize) {
name = "closeWindow";
}
Symbol 44 MovieClip [dragfirst] Frame 1
_root.simPaused = true;
_root.tempTouch.push(closeTouch);
Instance of Symbol 20 MovieClip "closeTouch" in Symbol 44 MovieClip [dragfirst] Frame 1
//component parameters
onClipEvent (initialize) {
name = "closeWindow";
}
Symbol 47 Button
on (rollOver, dragOver) {
rollID = setInterval(shineIt, 33);
}
on (rollOut, dragOut) {
resetI();
clearInterval(rollID);
}
on (release) {
resetI();
clearInterval(rollID);
_root.applyFunction(false, "info", id);
}
Symbol 48 MovieClip Frame 1
function shineIt() {
if (clipButton._alpha >= 100) {
clearInterval(rollID);
} else {
clipButton._alpha = clipButton._alpha + 3;
}
}
function resetI() {
clipButton._alpha = initAlpha;
}
function updateInit(newAlpha) {
initAlpha = newAlpha;
resetI();
}
clipButton._alpha = initAlpha;
infoTouch.param1 = id;
_root.tempTouch.push(infoTouch);
Instance of Symbol 20 MovieClip "infoTouch" in Symbol 48 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
name = "info";
}
Symbol 49 MovieClip [info holder] Frame 1
function updateInfos() {
trace("updating");
infoAlpha = infoAlpha + (10 / par);
var n = 0;
while (n < infoArray.length) {
infoArray[n].updateInit(infoAlpha);
n++;
}
}
function setInfos() {
var n = 0;
while (n < infoArray.length) {
infoArray[n]._x = infoArray[n].x * _root.pixelStep;
infoArray[n]._y = infoArray[n].y * _root.pixelStep;
n++;
}
}
infoArray = Array();
infoAlpha = 40;
var i = 0;
while (i < infos.length) {
newinfo = infoclip.duplicateMovieClip("info" + i, i);
newinfo.id = infos[i].id;
newinfo.x = infos[i].x;
newinfo.y = infos[i].y;
newinfo.initAlpha = infoAlpha;
infoArray.push(newinfo);
i++;
}
setInfos();
Symbol 50 Button
on (release) {
_root.simPaused = false;
this.unloadMovie();
}
Symbol 52 MovieClip [help window] Frame 1
infoButton.useHandCursor = false;
_root.simPaused = true;
stop();
_root.tempTouch.push(closeTouch);
Instance of Symbol 20 MovieClip "closeTouch" in Symbol 52 MovieClip [help window] Frame 1
//component parameters
onClipEvent (initialize) {
name = "closeWindow";
}
Instance of Symbol 58 MovieClip in Symbol 59 MovieClip Frame 1
onClipEvent (enterFrame) {
this.swapDepths(10000);
}
Symbol 60 MovieClip Frame 1
this.onEnterFrame = function () {
if ((paths < 1) || (paths > 9999)) {
paths = 1;
}
newdepth = ((this._currentframe < 18) ? (paths) : (paths + 10000));
newpath = pathClip.attachMovie("animpath", "path" + paths, newdepth);
newpath._x = part._x;
newpath._y = part._y;
paths++;
};
Symbol 60 MovieClip Frame 35
gotoAndPlay (2);
Symbol 73 MovieClip [info window] Frame 1
infoButton.useHandCursor = false;
_root.simPaused = true;
gotoAndStop("id" + id);
_root.tempTouch.push(closeTouch);
Instance of Symbol 20 MovieClip "closeTouch" in Symbol 73 MovieClip [info window] Frame 1
//component parameters
onClipEvent (initialize) {
name = "closeWindow";
}
Symbol 73 MovieClip [info window] Frame 2
trace(_root.simPaused);
Symbol 79 Button
on (release) {
_root.applyFunction(false, "beginQuiz", this);
}
Symbol 84 Button
on (release) {
_root.applyFunction(false, "quizAnswer", _parent, this);
}
Symbol 87 MovieClip Frame 1
if (answer.answer.length > 0) {
answer_text.text = answer.answer;
answer_text.autoSize = "left";
number_text.text = _parent.answerNum + ".";
answer_button._height = answer_text.textHeight + 2;
answerTouch._height = answer_button._height;
_parent.showAnswer(answer_text.textHeight);
}
answerTouch.param1 = _parent;
answerTouch.param2 = this;
_root.tempTouch.push(answerTouch);
Instance of Symbol 20 MovieClip "answerTouch" in Symbol 87 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
name = "quizAnswer";
}
Symbol 92 Button
on (release) {
_root.applyFunction(false, "tryAgain", this);
}
Symbol 97 Button
on (release) {
_root.applyFunction(false, "quizMe");
}
Symbol 105 Button
on (release) {
_root.applyFunction(false, "quizDone");
}
Symbol 107 MovieClip [quiz] Frame 1
stop();
qbutton.useHandCursor = false;
if (_root.quiz_started != true) {
gotoAndStop (2);
} else if (_root.quiz_complete == _root.quiz_array.length) {
gotoAndStop (22);
} else {
gotoAndStop (7);
}
var skipped = false;
myListener = new Object();
myListener.onKeyDown = function () {
if ((Key.isDown(83) && (Key.isDown(81))) && (skipped != true)) {
skipped = true;
_root.quiz_done = true;
_root.quizMe();
}
};
Key.addListener(myListener);
Symbol 107 MovieClip [quiz] Frame 2
beginTouch.param1 = this;
_root.tempTouch.push(beginTouch);
Instance of Symbol 20 MovieClip "beginTouch" in Symbol 107 MovieClip [quiz] Frame 2
//component parameters
onClipEvent (initialize) {
name = "beginQuiz";
}
Symbol 107 MovieClip [quiz] Frame 7
function showAnswer(height) {
if (answerNum >= answerLength) {
return(undefined);
}
var newAns = answerclip.duplicateMovieClip("answer" + answerNum, answerNum);
totY = totY + (height + gap);
newAns._y = totY;
newAns.answer = quiz.answers[answerNum];
newAns.init();
answerNum++;
}
function answerClick(pickanswer) {
_root.quiz_guesses++;
_root.updateData("qtry");
var i = 0;
while (i < answerLength) {
var testclip = eval ("this.answer" + i);
if (pickanswer != testclip) {
testclip._visible = false;
} else {
textPlace = ((question_text.textHeight + question_text._y) + (gap * 3)) + pickanswer.answer_text.textHeight;
pickanswer.answer_button.enabled = false;
theanswer = pickanswer;
}
i++;
}
}
stop();
of_text.text = ((_root.quiz_complete + 1) + " of ") + _root.quiz_array.length;
question_text.text = quiz.question;
question_text.autoSize = "left";
var answerLength = quiz.answers.length;
var answerNum = 0;
var gap = 5;
var totY = question_text._y;
var textPlace = 0;
var theanswer = null;
showAnswer(question_text.textHeight);
this.onEnterFrame = function () {
if (theanswer != null) {
var thedist = (theanswer._y - ((question_text.textHeight + question_text._y) + gap));
if (thedist < 2) {
clearInterval(moveID);
if (theanswer.answer.correct == true) {
_root.updateData("qdone");
_root.quiz_complete++;
gotoAndStop (17);
right._y = textPlace;
} else {
gotoAndStop (12);
wrong._y = textPlace;
}
theanswer = null;
}
theanswer._y = theanswer._y - (thedist / 10);
}
};
Symbol 107 MovieClip [quiz] Frame 12
wrong.incorrect_text.text = quiz.wrong;
tryTouch.param1 = this;
_root.tempTouch.push(tryTouch);
Instance of Symbol 20 MovieClip "tryTouch" in Symbol 107 MovieClip [quiz] Frame 12
//component parameters
onClipEvent (initialize) {
name = "tryAgain";
}
Symbol 107 MovieClip [quiz] Frame 17
right.correct_text.text = quiz.right;
_root.tempTouch.push(nextTouch);
Instance of Symbol 20 MovieClip "nextTouch" in Symbol 107 MovieClip [quiz] Frame 17
//component parameters
onClipEvent (initialize) {
name = "quizMe";
}
Symbol 107 MovieClip [quiz] Frame 22
var qtotal = (_root.quiz_guesses - (_root.quiz_array.length * 2));
if (qtotal > 0) {
newscoreq = "+" + qtotal;
} else if (qtotal < 0) {
newscoreq = qtotal;
} else {
newscoreq = "even";
}
_root.tempTouch.push(doneTouch);
Instance of Symbol 20 MovieClip "doneTouch" in Symbol 107 MovieClip [quiz] Frame 22
//component parameters
onClipEvent (initialize) {
name = "quizDone";
}
Symbol 109 MovieClip [animpath] Frame 1
this.onEnterFrame = function () {
this._x++;
if (this._x > 87) {
this.unloadMovie();
}
};
Symbol 110 MovieClip [vs strength] Frame 1
function updateValue(x) {
curValue = (x * valuePerPix) + min;
_parent.updateText(curValue);
}
function setSlider(value) {
_parent.handle._x = value / valuePerPix;
}
function saveValue() {
_root.grid.custom_strength = curValue;
trace("strength:" + curValue);
}
_parent.name.text = "S";
var min = 0;
var max = 1000;
var init = _root.grid.custom_strength;
var valuePerPix = ((max - min) / width);
var curValue = min;
updateValue(0);
setSlider(init);
Symbol 111 MovieClip [vs length] Frame 1
function setSlider(value) {
_parent.handle._x = value / valuePerPix;
}
function updateValue(x) {
curValue = (x * valuePerPix) + min;
_parent.updateText(curValue);
}
function saveValue() {
_root.grid.custom_length = curValue;
}
_parent.name.text = "L";
var min = 0.1;
var max = 10.1;
var init = _root.grid.custom_length;
var valuePerPix = ((max - min) / width);
var curValue = init;
setSlider(init);
updateValue(0);
Symbol 112 MovieClip [vs multi] Frame 1
function updateValue(x) {
curValue_ez = (x * valuePerPix_ez) + min_ez;
curValue_str = (x * valuePerPix_str) + min_str;
_parent.updateText(curValue_ez, curValue_str);
}
function setSlider(value) {
_parent.handle._x = value / valuePerPix_ez;
}
function saveValue() {
_root.grid.elecfield._alpha = curValue_ez / alphaPerValue;
_root.grid.custom_Ez = curValue_ez;
_root.grid.custom_strength = curValue_str;
}
_parent.name.text = "Ez";
var min_ez = 0;
var max_ez = 2;
var min_str = 0;
var max_str = 50;
var init = 0;
var valuePerPix_ez = ((max_ez - min_ez) / width);
var valuePerPix_str = ((max_str - min_str) / width);
var alphaPerValue = ((max_ez - min_ez) / 100);
updateValue(0);
setSlider(_root.grid.custom_Ez);
Symbol 113 MovieClip [vs ez] Frame 1
function updateValue(x) {
curValue = (x * valuePerPix) + min;
_parent.updateText(curValue);
}
function setSlider(value) {
_parent.handle._x = value / valuePerPix;
}
function saveValue() {
_root.grid.elecfield._alpha = curValue / alphaPerValue;
_root.grid.custom_Ez = curValue;
}
_parent.name.text = "Ez";
var min = 0;
var max = 5;
var init = _root.grid.custom_Ez;
var valuePerPix = ((max - min) / width);
var alphaPerValue = ((max - min) / 100);
var curValue = min;
updateValue(0);
setSlider(init);
Symbol 121 MovieClip Frame 1
stop();
Symbol 125 MovieClip Frame 81
muteit = new Sound(hole);
muteit.setVolume(0);
hole.gotoAndPlay("spin");
Symbol 130 Button
on (release) {
_root.applyFunction(false, "introClose");
}
Symbol 131 MovieClip [intro expl] Frame 1
cover.useHandCursor = false;
_root.tempTouch.push(closeTouch);
Instance of Symbol 20 MovieClip "closeTouch" in Symbol 131 MovieClip [intro expl] Frame 1
//component parameters
onClipEvent (initialize) {
name = "introClose";
}
Symbol 140 Button
on (release) {
_root.applyFunction(false, "dorestart");
}
Symbol 141 Button
on (release) {
_root.applyFunction(false, "closeWindow");
}
Symbol 144 MovieClip [reset cover] Frame 1
_root.simPaused = true;
cover.useHandCursor = false;
Symbol 151 MovieClip Frame 1
stop();
Symbol 152 MovieClip Frame 1
function makeAurora(y) {
if (y < 0) {
aurora1.gotoAndPlay("play");
} else {
aurora2.gotoAndPlay("play");
}
}
stop();
Symbol 158 MovieClip Frame 1
FLARE = random(50);
if (FLARE eq "10") {
gotoAndPlay (6);
}
Symbol 158 MovieClip Frame 5
gotoAndPlay (1);
Symbol 163 MovieClip Frame 1
function rotate() {
percent = Math.floor((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
thelines._rotation = thelines._rotation + ((percent * 2) / 15);
themask._rotation = themask._rotation + ((percent * 2) / 15);
percenttext.text = Math.round(percent) + "%";
if ((percent >= 100) && (_root.getBytesTotal() > 100)) {
clearInterval(rotateID);
_root.play();
}
updateAfterEvent();
}
rotateID = setInterval(rotate, 10);
percent = 0;
Symbol 166 Button
on (release) {
getURL ("http://www.spaceweathercenter.org", "_new");
}
Symbol 172 Button
on (release) {
if (soundon == true) {
globalsound.setVolume(0);
soundon = false;
soundoff._visible = true;
} else {
globalsound.setVolume(100);
soundon = true;
soundoff._visible = false;
}
}
Symbol 176 MovieClip Frame 1
globalsound = new Sound();
globalsound.setVolume(100);
soundon = true;
Instance of Symbol 175 MovieClip "soundoff" in Symbol 176 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 186 Button
on (release) {
updateData("exit");
getURL ("windowClose.html");
}
Symbol 191 Button
on (release) {
applyFunction(false, "instructions");
}
Symbol 196 Button
on (release) {
applyFunction(false, "play");
}
Symbol 207 Button
on (release) {
clearScores();
curIndex = curIndex + limit;
getHighScores();
}
Symbol 208 Button
on (release) {
clearScores();
curIndex = curIndex - limit;
curIndex = ((curIndex < 0) ? 0 : (curIndex));
getHighScores();
}
Symbol 210 MovieClip Frame 1
function getHighScores() {
sendIndex.index = curIndex;
sendIndex.action = "getHigh";
sendIndex.sendAndLoad("scores/minigolf.php", getScores, "POST");
}
function clearScores() {
arrowup._visible = false;
arrowdown._visible = false;
var i = 0;
while (i < limit) {
var delThis = eval ("this.thescore" + i);
delThis.unloadMovie();
i++;
}
}
var getScores = new LoadVars();
var sendIndex = new LoadVars();
var curIndex = 0;
var limit = 15;
thescore._visible = false;
arrowup._visible = false;
arrowdown._visible = false;
getHighScores();
getScores.onLoad = function () {
var highNames = getScores.names.split("|");
var highScores = getScores.scores.split("|");
var i = 0;
while (i < limit) {
if (highNames[i].length < 1) {
break;
}
var tscore = thescore.duplicateMovieClip("thescore" + i, i);
tscore.name = highNames[i];
var editScore = highScores[i];
if (editScore > 0) {
editScore = "+" + editScore;
} else if (editScore == 0) {
editScore = "even";
}
tscore.score = editScore;
tscore.pos = ((i + curIndex) + 1) + ".";
tscore._y = i * 20;
i++;
}
arrowup._visible = ((curIndex == 0) ? false : true);
arrowdown._visible = ((highNames[15].length > 0) ? true : false);
};
Symbol 219 MovieClip Frame 1
stop();
Symbol 224 MovieClip Frame 1
var markers = 0;
var i = 0;
while (i < 16) {
var n = 0;
while (n < 6) {
newmarker = marker.duplicateMovieClip("marker" + markers, markers);
newmarker._x = i * 40;
newmarker._y = n * 40;
markers++;
n++;
}
i++;
}
marker.unloadMovie();
Instance of Symbol 152 MovieClip "earth" in Symbol 227 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_root.simPaused == true) {
return(undefined);
}
this.swapDepths(10000);
gmtdate = new Date();
theframe = Math.floor(((((gmtdate.getUTCHours() % 24) * 60) + gmtdate.getUTCMinutes()) * 0.0208333333333333) + 1);
gotoAndStop(theframe);
}
Symbol 228 MovieClip Frame 1
function makeGrid() {
var i = _root.lLimit;
while (i <= _root.rLimit) {
var n = _root.tLimit;
while (n <= _root.bLimit) {
var grItem = gridClip.attachMovie("grid item", "gr" + gr, gr);
grItem._x = i * _root.pixelStep;
grItem._y = n * _root.pixelStep;
gr++;
n++;
}
i++;
}
}
function finishLaunch() {
launcher.unloadMovie();
curBox.gotoAndStop("normal");
if ((_root.simPaused == true) || (_root.overInfo == true)) {
return(undefined);
}
if (goodLaunch == true) {
if (launcher.distance != 0) {
makeParticle(launchX, launchY, launcher.distance, launcher.angle);
noDrags = false;
} else if (noDrags == true) {
_root.newMess = _root.messages.attachMovie("dragfirst", "newMess", 1);
}
}
goodLaunch = false;
}
function makeParticle(lX, lY, distance, angle) {
var newParticle = particleClip.attachMovie("particle", "particle" + _root.particleNum, _root.particleNum);
var psound = new Sound(_root.hitsound);
psound.setVolume(distance * 2);
_root.hitsound.gotoAndPlay("play");
partArray.push(newParticle);
newParticle._x = lX;
newParticle._y = lY;
newParticle.x = lX / _root.pixelStep;
newParticle.Vx = (distance * Math.cos(angle + Math.PI)) / _root.pixelStep;
newParticle.pcolor.gotoAndStop(teeboxParams);
newParticle.level = teeboxParams;
if (teeboxParams != "none") {
_root.incrShots();
} else if (_root.practice != true) {
maxWrong--;
if (maxWrong == 0) {
_root.newMess = _root.messages.attachMovie("shootfromhere", "newMess", 1);
_root.simPaused = true;
maxWrong = 100;
}
}
_root.particleNum++;
if (overhead != true) {
newParticle.Vy = (distance * Math.sin(angle + Math.PI)) / _root.pixelStep;
newParticle.Vz = 0;
newParticle.y = lY / _root.pixelStep;
newParticle.z = 0;
}
newParticle.overhead = overhead;
newParticle.angle = 0;
_root.particleNum++;
}
function startLauncher() {
if ((_root.simPaused == true) || (_root.overInfo == true)) {
goodLaunch = false;
return(undefined);
}
if (Key.isDown(70) && (_root.field != "none")) {
trace(fieldClip);
newfLine = fieldClip.attachMovie("field line", "fLine" + fieldLines, fieldLines);
fieldArray.push({clip:newfLine, x:_xmouse / _root.pixelStep, y:_ymouse / _root.pixelStep});
newfLine.startx = _xmouse;
newfLine.starty = _ymouse;
newfLine.pixelStep = _root.pixelStep;
newfLine.overhead = false;
newofLine = _root.overhead.fieldClip.attachMovie("field line", "fLine" + fieldLines, fieldLines);
newofLine.startx = (_xmouse / _root.pixelStep) * _root.opixelStep;
newofLine.starty = 0;
newofLine.pixelStep = _root.pixelStep;
newofLine.overhead = true;
fieldLines++;
goodLaunch = false;
} else if ((((_xmouse < (_root.rLimit * _root.pixelStep)) && (_ymouse < (_root.bLimit * _root.pixelStep))) && (_xmouse > (_root.lLimit * _root.pixelStep))) && (_ymouse > (_root.tLimit * _root.pixelStep))) {
trace("good launch");
teeboxParams = checkForTeeboxes();
goodLaunch = true;
launchX = _xmouse;
launchY = _ymouse;
launcher = _parent.attachMovie("launcher", "launcher", 3000);
launcher._x = _root._xmouse;
launcher._y = _root._ymouse;
} else {
goodLaunch = false;
}
}
function clearParts() {
i = 0;
while (i < partArray.length) {
partArray[i].unloadMovie();
i++;
}
partArray = new Array();
}
function clearFields(redraw) {
tempArray = new Array();
n = 0;
while (n < fieldArray.length) {
fieldArray[n].clip.unloadMovie();
if (redraw == true) {
newfLine = fieldClip.attachMovie("field line", "fLine" + fieldLines, fieldLines);
tempArray.push({clip:newfLine, x:fieldArray[n].x, y:fieldArray[n].y});
newfLine.startx = fieldArray[n].x * _root.pixelStep;
newfLine.starty = fieldArray[n].y * _root.pixelStep;
newfLine.pixelStep = _root.pixelStep;
newfLine.overhead = false;
fieldLines++;
}
n++;
}
if (redraw == true) {
drewID = setInterval(drewFields, 30);
}
fieldArray = tempArray;
}
function drawField() {
if ((((_root.field == "horizontal") || (_root.field == "horizelec")) || (_root.field == "pinched")) || (_root.field == "magic")) {
var i = (((-_root.ysize) / 2) + _root.pixelStep);
while (i < (_root.ysize / 2)) {
newfLine = fieldClip.attachMovie("field line", "fLine" + fieldLines, fieldLines);
fieldArray.push({clip:newfLine, x:0, y:i / _root.pixelStep});
newfLine.startx = 0;
newfLine.starty = i;
newfLine.pixelStep = _root.pixelStep;
newfLine.overhead = false;
fieldLines++;
i = i + (_root.pixelStep * 3);
}
} else if (((_root.field == "dipole") || (_root.field == "tail")) || (_root.field == "custom")) {
trace(_root.field);
var i = 0;
while (i > ((-_root.xsize) / 2)) {
newfLine = fieldClip.attachMovie("field line", "fLine" + fieldLines, fieldLines);
fieldArray.push({clip:newfLine, x:i / _root.pixelStep, y:0});
newfLine.startx = i;
newfLine.starty = 0;
newfLine.pixelStep = _root.pixelStep;
newfLine.overhead = false;
fieldLines++;
i = i - (_root.pixelStep * 3);
}
var i = ((-_root.pixelStep) * 3);
while (i <= (_root.pixelStep * 3)) {
newfLine = fieldClip.attachMovie("field line", "fLine" + fieldLines, fieldLines);
fieldArray.push({clip:newfLine, x:i / _root.pixelStep, y:(-(_root.ysize / 4)) / _root.pixelStep});
newfLine.startx = i;
newfLine.starty = -(_root.ysize / 4);
newfLine.pixelStep = _root.pixelStep;
newfLine.overhead = false;
fieldLines++;
i = i + _root.pixelStep;
}
if ((_root.field == "tail") || (_root.field == "custom")) {
var i = 0;
while (i < ((_root.rLimit / 1.4) * _root.pixelStep)) {
newfLine = fieldClip.attachMovie("field line", "fLine" + fieldLines, fieldLines);
fieldArray.push({clip:newfLine, x:i / _root.pixelStep, y:0});
newfLine.startx = i;
newfLine.starty = -2;
newfLine.pixelStep = _root.pixelStep;
newfLine.overhead = false;
fieldLines++;
i = i + (_root.pixelStep * 4);
}
var i = ((-_root.pixelStep) * 4);
while (i < 0) {
newfLine = fieldClip.attachMovie("field line", "fLine" + fieldLines, fieldLines);
fieldArray.push({clip:newfLine, x:_root.rLimit / 1.2, y:i / _root.pixelStep});
newfLine.startx = (_root.rLimit / 1.2) * _root.pixelStep;
newfLine.starty = i;
newfLine.pixelStep = _root.pixelStep;
newfLine.overhead = false;
fieldLines++;
i = i + (_root.pixelStep * 2);
}
} else {
var i = 0;
while (i < (_root.rLimit * _root.pixelStep)) {
newfLine = fieldClip.attachMovie("field line", "fLine" + fieldLines, fieldLines);
fieldArray.push({clip:newfLine, x:i / _root.pixelStep, y:0});
newfLine.startx = i;
newfLine.starty = 0;
newfLine.pixelStep = _root.pixelStep;
newfLine.overhead = false;
fieldLines++;
i = i + (_root.pixelStep * 3);
}
}
}
drewID = setInterval(drewFields, 30);
}
function drewFields() {
_root.drawfield._visible = false;
fieldClip._visible = true;
_root.simPaused = false;
clearInterval(drewID);
}
var gridClip = this.createEmptyMovieClip("gridClip", 0);
var fieldClip = this.createEmptyMovieClip("fieldClip", 2);
var gr = 0;
var partMax = 50;
var partArray = new Array();
var fieldArray = new Array();
var noDrags = true;
this.onMouseUp = finishLaunch;
var maxParts = 20;
var maxWrong = 3;
var fieldLines = 0;
var teeboxParams = null;
this.onMouseDown = function () {
if (_root.touchScreen != true) {
startLauncher();
}
};
function moveLines() {
wave = true;
}
function stopLines() {
wave = false;
var i = 0;
while (i < waveLines.length) {
waveLines[i].drawLine(0);
i++;
}
}
var waveLines = new Array();
var wave = false;
var frameNum = 0;
this.onEnterFrame = function () {
frameNum++;
if (_root.curHole == 9) {
divisor = custom_Ez;
} else {
divisor = 1;
}
startFrame = ((divisor > 0) ? (Math.round(100 / divisor)) : null);
if (frameNum == startFrame) {
moveLines();
} else if (frameNum == (startFrame + 40)) {
stopLines();
} else if (frameNum > (startFrame + 40)) {
frameNum = 0;
}
};
function getCustomField(x, y, z) {
if (custom_gotAngles != true) {
custom_sps = Math.sin(custom_rad);
custom_cps = Math.cos(custom_rad);
custom_gotAngles = true;
}
custom_p = x * x;
custom_u = y * y;
custom_v = (3 * y) * x;
custom_t = z * z;
custom_q = 30574 / Math.pow(Math.sqrt((custom_p + custom_t) + custom_u), 5);
var retObj = new Object();
retObj.Bx = custom_q * ((((custom_t + custom_u) - (2 * custom_p)) * custom_sps) - (custom_v * custom_cps));
if (x > 0) {
retObj.Bx = retObj.Bx + ((-custom_strength) * _root.tanh(y / custom_length));
}
retObj.Bz = ((-3 * z) * custom_q) * ((x * custom_sps) + (y * custom_cps));
retObj.By = (custom_q * ((((custom_p + custom_t) - (2 * custom_u)) * custom_cps) - (custom_v * custom_sps))) - 2;
retObj.Ex = 0;
retObj.Ey = 0;
retObj.Ez = custom_Ez;
return(retObj);
}
var custom_sps = 0;
var custom_cps = 0;
var custom_angle = 0;
var custom_strength = 0;
var custom_length = 0.2;
var custom_Ez = 0;
var custom_rad = (custom_angle * (Math.PI/180));
var custom_gotAngles = false;
function getHorizontalElecField(x, y, z) {
var retObj = new Object();
retObj.Bx = 0.1;
retObj.By = 0;
retObj.Bz = 0;
retObj.Ex = 0;
retObj.Ey = 0;
retObj.Ez = 0.1;
return(retObj);
}
function getMagicField(x, y, z) {
m_sps = 0;
m_cps = 1;
x1 = x - 10;
x2 = x + 10;
p = x1 * x1;
u = y * y;
v = (3 * y) * x1;
q = 30574 / Math.pow(Math.sqrt(p + u), 5);
var retObj = new Object();
retObj.Bx = q * (((u - (2 * p)) * m_sps) - (v * m_cps));
if (x1 > 0) {
retObj.Bx = retObj.Bx + (_root.Bx0 * _root.tanh(y / _root.a));
}
retObj.By = (q * (((p - (2 * u)) * m_cps) - (v * m_sps))) + (_root.By0 / 1);
DRel = 0.2;
p = x2 * x2;
v = (3 * y) * x2;
q = 30574 / Math.pow(Math.sqrt(p + u), 5);
retObj.Bx = retObj.Bx + (DRel * (q * (((u - (2 * p)) * m_sps) - (v * m_cps))));
if (x2 > 0) {
retObj.Bx = retObj.Bx + (DRel * (_root.Bx0 * _root.tanh(y / _root.a)));
}
retObj.By = retObj.By + ((DRel * (q * (((p - (2 * u)) * m_cps) - (v * m_sps)))) + (_root.By0 / 1));
DMag = 0.02;
retObj.Bx = retObj.Bx * DMag;
retObj.By = retObj.By * DMag;
BMax = 100;
BMag = (retObj.Bx * retObj.Bx) + (retObj.By * retObj.By);
if (BMag > BMax) {
Br = Math.Sqrt(BMax / BMag);
Br = BMax / BMag;
retObj.Bx = retObj.Bx * Br;
retObj.By = retObj.By * Br;
}
retObj.Bx = retObj.Bx - 0;
retObj.Bz = 0;
retObj.Ex = 0;
retObj.Ey = 0;
retObj.Ez = 0.01;
return(retObj);
}
function getBlankField(x, y, z) {
var retObj = new Object();
retObj.Bx = 0;
retObj.By = 0;
retObj.Bz = 0;
retObj.Ex = 0;
retObj.Ey = 0;
retObj.Ez = _root.Ez / 1;
return(retObj);
}
function getPinchedField(x, y, z) {
p_sps = 1;
p_cps = 0;
x1 = x - 15;
x2 = x + 15;
p = x1 * x1;
u = y * y;
v = (3 * y) * x1;
q = 30574 / Math.pow(Math.sqrt(p + u), 5);
var retObj = new Object();
retObj.Bx = q * (((u - (2 * p)) * p_sps) - (v * p_cps));
if (x1 > 0) {
retObj.Bx = retObj.Bx + (_root.Bx0 * _root.tanh(y / _root.a));
}
retObj.By = (q * (((p - (2 * u)) * p_cps) - (v * p_sps))) + (_root.By0 / 1);
p = x2 * x2;
v = (3 * y) * x2;
q = 30574 / Math.pow(Math.sqrt(p + u), 5);
retObj.Bx = retObj.Bx + (q * (((u - (2 * p)) * p_sps) - (v * p_cps)));
if (x2 > 0) {
retObj.Bx = retObj.Bx + (_root.Bx0 * _root.tanh(y / _root.a));
}
retObj.By = retObj.By + ((q * (((p - (2 * u)) * p_cps) - (v * p_sps))) + (_root.By0 / 1));
DMag = 0.02;
retObj.Bx = retObj.Bx * DMag;
retObj.By = retObj.By * DMag;
BMax = 100000000 /* 0x5F5E100 */;
BMag = (retObj.Bx * retObj.Bx) + (retObj.By * retObj.By);
if (BMag > BMax) {
Br = Math.sqrt(BMax / BMag);
Br = BMax / BMag;
retObj.Bx = retObj.Bx * Br;
retObj.By = retObj.By * Br;
retObj.Bx = retObj.Bx - ((1 - Br) * BMax);
}
retObj.Bx = retObj.Bx - 0.2;
retObj.Bz = 0;
retObj.Ex = 0;
retObj.Ey = 0;
retObj.Ez = 0;
return(retObj);
}
function getDipoleField(x, y, z) {
if (gotAngles != true) {
sps = Math.sin(rad);
cps = Math.cos(rad);
gotAngles = true;
}
p = x * x;
u = y * y;
v = (3 * y) * x;
t = z * z;
q = 30574 / Math.pow(Math.sqrt((p + t) + u), 5);
var retObj = new Object();
retObj.Bx = q * ((((t + u) - (2 * p)) * sps) - (v * cps));
if (x > 0) {
retObj.Bx = retObj.Bx + (_root.Bx0 * _root.tanh(y / _root.a));
}
retObj.Bz = ((-3 * z) * q) * ((x * sps) + (y * cps));
retObj.By = (q * ((((p + t) - (2 * u)) * cps) - (v * sps))) + (_root.By0 / 1);
retObj.Ex = 0;
retObj.Ey = 0;
retObj.Ez = _root.Ez / 1;
return(retObj);
}
var sps = 0;
var cps = 0;
var angle = 0;
var rad = (angle * (Math.PI/180));
var gotAngles = false;
var sps = 0;
var cps = 0;
function getHorizontalField(x, y, z) {
var retObj = new Object();
retObj.Bx = 0.1;
retObj.By = 0;
retObj.Bz = 0;
retObj.Ex = 0;
retObj.Ey = 0;
retObj.Ez = _root.Ez / 1;
return(retObj);
}
function getMagnetotail(x, y, z) {
if (gotAngles != true) {
sps = Math.sin(rad);
cps = Math.cos(rad);
gotAngles = true;
}
p = x * x;
u = y * y;
v = (3 * y) * x;
t = z * z;
q = 30574 / Math.pow(Math.sqrt((p + t) + u), 5);
var retObj = new Object();
retObj.Bx = q * ((((t + u) - (2 * p)) * sps) - (v * cps));
if (x > 0) {
retObj.Bx = retObj.Bx + (-50 * _root.tanh(y / 0.2));
}
retObj.Bz = ((-3 * z) * q) * ((x * sps) + (y * cps));
retObj.By = (q * ((((p + t) - (2 * u)) * cps) - (v * sps))) - 2;
retObj.Ex = 0;
retObj.Ey = 0;
retObj.Ez = 2;
return(retObj);
}
var sps = 0;
var cps = 0;
var angle = 0;
var rad = (angle * (Math.PI/180));
var gotAngles = false;
var sps = 0;
var cps = 0;
function getFieldFromArray(x, y, z) {
xIndex = Math.floor(x);
yIndex = Math.floor(y);
p1 = fieldArray[xIndex][yIndex];
p2 = fieldArray[xIndex][yIndex + 1];
p3 = fieldArray[xIndex + 1][yIndex];
p4 = fieldArray[xIndex + 1][yIndex + 1];
dX = x - p1.x;
dY = y - p1.y;
var retObj = new Object();
retObj.Bx = ((((p3.Bx * (dX * (1 - dY))) + (p4.Bx * (dX * dY))) + (p2.Bx * (dY * (1 - dX)))) + (p1.Bx * ((1 - dX) * (1 - dY)))) * (_root.timestep / 2);
retObj.By = ((((p3.By * (dX * (1 - dY))) + (p4.By * (dX * dY))) + (p2.By * (dY * (1 - dX)))) + (p1.By * ((1 - dX) * (1 - dY)))) * (_root.timestep / 2);
retObj.Bz = ((((p3.Bz * (dX * (1 - dY))) + (p4.Bz * (dX * dY))) + (p2.Bz * (dY * (1 - dX)))) + (p1.Bz * ((1 - dX) * (1 - dY)))) * (_root.timestep / 2);
retObj.Ex = ((((p3.Ex * (dX * (1 - dY))) + (p4.Ex * (dX * dY))) + (p2.Ex * (dY * (1 - dX)))) + (p1.Ex * ((1 - dX) * (1 - dY)))) * (_root.timestep / 2);
retObj.Ey = ((((p3.Ey * (dX * (1 - dY))) + (p4.Ey * (dX * dY))) + (p2.Ey * (dY * (1 - dX)))) + (p1.Ey * ((1 - dX) * (1 - dY)))) * (_root.timestep / 2);
return(retObj);
}
var xIndex = 0;
var yIndex = 0;
if (_root.method == "use array") {
if (!(_root.field === "horizontal")) {
} else {
makeStandardGrid();
}
}
function checkForTeeboxes() {
if (_root.practice == true) {
return("none");
}
var teeboxes = _root.holes[_root.curHole].teeboxes;
i = 0;
while (i < teeboxes.length) {
curBox = eval (("this." + teeboxes[i].level) + "tee");
if (curBox.hitTest(_root._xmouse, _root._ymouse, true)) {
curBox.gotoAndStop("high");
return(teeboxes[i].level);
}
i++;
}
return("none");
}
var curBox = null;
Instance of Symbol 121 MovieClip "hole" in Symbol 228 MovieClip Frame 1
onClipEvent (load) {
this.swapDepths(100);
}
Instance of Symbol 221 MovieClip "flag" in Symbol 228 MovieClip Frame 1
onClipEvent (load) {
this.swapDepths(1001);
}
Instance of Symbol 227 MovieClip "particleClip" in Symbol 228 MovieClip Frame 1
onClipEvent (load) {
this.swapDepths(1000);
}
Symbol 235 Button
on (release) {
_root.applyFunction(false, "selectHole", hole - 1);
}
on (rollOver, dragOver) {
if ((hole == 10) && (_root.quiz_done != true)) {
_root.textarea.descr.gotoAndStop("quiz");
} else {
_root.textarea.showDescr(hole);
}
}
on (rollOut, dragOut) {
_root.textarea.clearDescr();
}
Symbol 242 MovieClip Frame 1
_root.touchArray.push(holeTouch);
holeTouch.param1 = hole - 1;
Instance of Symbol 20 MovieClip "holeTouch" in Symbol 242 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
name = "selectHole";
}
Symbol 251 MovieClip Frame 1
shots = 0;
Instance of Symbol 247 MovieClip in Symbol 251 MovieClip Frame 1
onClipEvent (load) {
this.swapDepths(100);
}
Symbol 266 MovieClip Frame 15
stop();
Symbol 268 MovieClip Frame 5
stop();
Symbol 269 Button
on (release) {
applyFunction(false, "clearParts");
}
Symbol 273 Button
on (release) {
applyFunction(false, "help");
}
Symbol 276 Button
on (release) {
applyFunction(false, "restart");
}
Symbol 301 Button
on (press) {
if (_root.touchScreen != true) {
this.startDrag(false, 0, 0, 100, 0);
}
}
on (release, releaseOutside) {
stopDrag();
}
Symbol 302 MovieClip Frame 1
dragTouch.param1 = this;
_root.tempTouch.push(dragTouch);
Instance of Symbol 20 MovieClip "dragTouch" in Symbol 302 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
name = "dragValue";
}
Symbol 305 MovieClip Frame 1
function updateText(sentValue, sentValue2) {
value.text = sentValue;
value2.text = sentValue2;
}
var handler = this.attachMovie("vs " + handler, "handler", 1);
handler.width = 100;
var curPos = 0;
this.onEnterFrame = function () {
if (handle._x != curPos) {
handler.updateValue(handle._x);
curPos = handle._x;
}
};
Symbol 308 Button
on (release) {
_root.applyFunction(false, "setValues", slider0);
}
Symbol 313 MovieClip Frame 1
stop();
Symbol 313 MovieClip Frame 47
setTouch.param1 = slider0;
_root.tempTouch.push(setTouch);
Instance of Symbol 20 MovieClip "setTouch" in Symbol 313 MovieClip Frame 47
//component parameters
onClipEvent (initialize) {
name = "setValues";
}
Instance of Symbol 305 MovieClip "slider0" in Symbol 313 MovieClip Frame 47
//component parameters
onClipEvent (initialize) {
handler = "multi";
}
Symbol 314 MovieClip Frame 1
function showDescr(hole) {
descr.gotoAndStop("hole" + hole);
}
function clearDescr() {
if ((_root.curHole == 9) && (_root.quiz_done != true)) {
descr.gotoAndStop("quiz");
} else {
descr.gotoAndStop("hole" + (_root.curHole + 1));
}
}
showDescr(1);
Symbol 317 MovieClip Frame 1
drawButton.useHandCursor = false;
Symbol 320 Button
on (release) {
_root.applyFunction(false, "nextHole");
}
Symbol 322 MovieClip Frame 1
stop();
Symbol 322 MovieClip Frame 2
_root.tempTouch.push(nextTouch);
Instance of Symbol 20 MovieClip "nextTouch" in Symbol 322 MovieClip Frame 2
//component parameters
onClipEvent (initialize) {
name = "nextHole";
}
Symbol 325 MovieClip Frame 1
stop();
Symbol 330 Button
on (release) {
nameCheck();
}
Symbol 340 MovieClip Frame 1
stop();