Frame 1
function checkLoad() {
mcClip = mcRoot;
var _local4 = mcClip.getBytesLoaded();
if (isNaN(_local4)) {
_local4 = 0;
}
var _local2 = mcClip.getBytesTotal();
if (isNaN(_local2)) {
_local2 = 0;
}
var _local3 = 0;
if (_local2 < 50) {
return(false);
}
if (_local2 != 0) {
_local3 = Math.round((_local4 * 100) / _local2);
}
mcPreloader.setPercentLoaded(_local3);
if (_local3 >= 100) {
mcClip.gotoAndPlay("loaded");
mcPreloader._visible = false;
this.removeMovieClip();
}
}
_global.mcRoot = this;
_global.nTopDepth = 1234;
stop();
mcLoader = this.createEmptyMovieClip("mcLoader", _global.nTopDepth);
_global.nTopDepth++;
mcLoader.onEnterFrame = checkLoad;
mcPreloader.setPercentLoaded = function (nPct) {
mcRoot.mcPreloader.txtPercent.text = nPct + "%";
};
Frame 7
function initSoundBtns() {
if (mcRoot.bMute == undefined) {
mcRoot.bMute = false;
mcRoot.sndMute = new Sound();
mcRoot.sndMute.setVolume(100);
}
mcRoot.setDefaultRollOver(mcRoot.mcSoundOffBtn);
mcRoot.mcSoundOffBtn.onRelease = function () {
mcRoot.bMute = true;
mcRoot.mcSoundOnBtn._visible = true;
mcRoot.mcSoundOffBtn._visible = false;
mcRoot.sndMute.setVolume(0);
};
mcRoot.setDefaultRollOver(mcRoot.mcSoundOnBtn);
mcRoot.mcSoundOnBtn.onRelease = function () {
mcRoot.bMute = false;
mcRoot.mcSoundOnBtn._visible = false;
mcRoot.mcSoundOffBtn._visible = true;
mcRoot.sndMute.setVolume(100);
};
if (mcRoot.bMute) {
mcRoot.mcSoundOnBtn._visible = true;
mcRoot.mcSoundOffBtn._visible = false;
} else {
mcRoot.mcSoundOnBtn._visible = false;
mcRoot.mcSoundOffBtn._visible = true;
}
}
function initHurling() {
mcRoot.initSoundBtns();
mcRoot.setDefaultRollOver(mcRoot.mcReturnBtn);
mcRoot.mcReturnBtn.onRelease = function () {
delete mcRoot.mcHurling.onMouseUp;
delete mcRoot.mcHurling.mcRock.onEnterFrame;
mcRoot.gotoAndPlay("hurling_out");
};
mcRoot.setDefaultRollOver(mcRoot.mcWindow.mcFriendBtn);
mcRoot.mcWindow.mcFriendBtn.onRelease = function () {
mcRoot.mcEmail.gotoAndPlay("open");
mcRoot.bMailHighScore = true;
};
var mcRock = mcRoot.mcHurling.mcRock;
var mcMonkeyBumpers = mcRoot.mcHurling.mcMonkeyBumpers;
var mcMonkey = mcRoot.mcHurling.mcMonkeyBumpers.mcMonkey;
var mcTile1 = mcRoot.mcHurling.mcTile1;
var mcCranky = mcRoot.mcHurling.mcCranky;
var mcBubble = mcRoot.mcHurling.mcBubble;
var mcMarkBottom = mcRoot.mcHurling.mcMarkBottom;
var mcMarkTop = mcRoot.mcHurling.mcMarkTop;
var mcMarkRight = mcRoot.mcHurling.mcMarkRight;
var mcThrowOver = mcRoot.mcHurling.mcThrowOver;
var xTileStart = mcTile1._x;
mcTile1.xStart = mcTile1._x;
var xTileStop = (xTileStart + (mcTile1._width / 2));
var yGravity = 0.2;
var yGravityMax = 7;
var xRockStart = mcRock._x;
var yRockStart = mcRock._y;
var xMonkeyBumpersStart = mcMonkeyBumpers._x;
mcMonkeyBumpers.xStart = mcMonkeyBumpers._x;
var xStartTiling = 250;
mcMonkeyBumpers._x = mcMonkeyBumpers._x + 200;
mcRock._x = mcRock._x + 200;
var xTotalMove = 0;
if (mcRoot.nBestThrow == undefined) {
mcRoot.nLastThrow = 0;
mcRoot.nBestThrow = 0;
} else {
mcRoot.mcHurling.txtLast.text = mcRoot.nLastThrow.toString() + " ft.";
mcRoot.mcHurling.txtBest.text = mcRoot.nBestThrow.toString() + " ft.";
}
mcRoot.bThrowing = false;
mcRoot.bSpinning = false;
var nRotationStep = 0.25;
var nRotationCurrentSpeed = 0;
var nRotationMaxSpeed = 23;
var nRotationOffset = 30;
mcRock._visible = false;
mcMonkeyBumpers.onPress = function () {
if ((mcRoot.bSpinning != true) && (mcRoot.bThrowing != true)) {
mcRoot.startSpinning();
mcMonkey._rotation = 0;
mcRock._rotation = 0;
mcRock._x = xRockStart;
mcRock._y = yRockStart;
mcMonkey._visible = true;
mcRock._visible = false;
mcMonkey.mcRock._visible = true;
mcMonkeyBumpers._x = xMonkeyBumpersStart;
mcTile1._x = xTileStart;
mcTile1.mcSign1.txtDistance.text = "0";
mcTile1.mcSign2.txtDistance.text = "50";
if (mcCranky._currentframe != 1) {
mcCranky.gotoAndPlay("close");
}
nRotationCurrentSpeed = 0;
xTotalMove = 0;
mcRoot.bThrowing = false;
mcRoot.bSpinning = true;
mcRock.onEnterFrame = function () {
mcMonkey._rotation = mcMonkey._rotation + nRotationCurrentSpeed;
if (nRotationCurrentSpeed < nRotationMaxSpeed) {
nRotationCurrentSpeed = nRotationCurrentSpeed + nRotationStep;
}
mcRock._rotation = mcMonkey._rotation;
if ((mcMonkey.nLastRotation < 0) && (mcMonkey._rotation > 0)) {
mcMonkeyBumpers.mcSound2.gotoAndPlay("throw");
}
mcMonkey.nLastRotation = mcMonkey._rotation;
};
} else if (mcRoot.bThrowing != true) {
delete mcRock.onEnterFrame;
mcRoot.bSpinning = false;
mcRoot.bThrowing = true;
var _local4 = mcMonkey._rotation + nRotationOffset;
var _local5 = mcMarkBottom;
if ((_local4 > -90) && (_local4 < 0)) {
_local5 = mcMarkTop;
} else if ((_local4 >= 0) && (_local4 < 90)) {
_local5 = mcMarkRight;
}
var _local2 = mcRoot.convertToStage(_local5);
var _local8 = mcRoot.convertToStage(mcRock.mcRock);
_local2.x = _local2.x - mcRoot.mcHurling._x;
_local2.y = _local2.y - mcRoot.mcHurling._y;
_local8.x = _local8.x - mcRoot.mcHurling._x;
_local8.y = _local8.y - mcRoot.mcHurling._y;
_local8.x = _local8.x + ((Math.random() * 20) - 10);
_local8.y = _local8.y + ((Math.random() * 20) - 10);
mcRock.xMove = _local2.x - _local8.x;
mcRock.yMove = (_local2.y - _local8.y) * -0.7;
var _local10 = mcRoot.dist(_local2.x, _local2.y, _local8.x, _local8.y);
var _local9 = Math.random() * 15;
mcRock = mcRoot.scaleVectorToMag(mcRock, _local10, nRotationCurrentSpeed + _local9);
mcMonkey.mcRock._visible = false;
mcRock._visible = true;
mcRock.gotoAndPlay("spin");
mcMonkeyBumpers.mcSound.gotoAndPlay("throw");
mcRock.nTireCounter = 0;
mcRock.onEnterFrame = function () {
mcRock.nTireCounter++;
if (mcRock.nTireCounter > 10) {
var _local5 = mcRoot.convertToStage(mcRock.mcRock);
if (_local5.y > 200) {
var _local1 = null;
var _local2 = null;
if (mcRock.hitTest(mcTile1.mcTire1)) {
_local1 = mcTile1.mcTire1;
_local2 = mcTile1.mcTire3;
} else if (mcRock.hitTest(mcTile1.mcTire2)) {
_local1 = mcTile1.mcTire2;
_local2 = mcTile1.mcTire4;
} else if (mcRock.hitTest(mcTile1.mcTire3)) {
_local1 = mcTile1.mcTire3;
_local2 = mcTile1.mcTire1;
} else if (mcRock.hitTest(mcTile1.mcTire4)) {
_local1 = mcTile1.mcTire4;
_local2 = mcTile1.mcTire2;
}
if (_local1 != null) {
var _local4 = mcRoot.convertToStage(mcTile1.mcTire1);
_local5 = mcRoot.convertToStage(mcRock.mcRock);
if (_local4.y > _local5.y) {
var _local3 = -1 - (Math.random() / 2);
mcRock.yMove = mcRock.yMove * _local3;
mcRock.nTireCounter = 0;
_local1.gotoAndPlay("bounce_top");
_local2.gotoAndPlay("bounce_top");
} else {
mcRock.xMove = mcRock.xMove * -1;
mcRock.nTireCounter = 0;
_local1.gotoAndPlay("bounce_side");
}
}
}
}
if (mcRock._x > xStartTiling) {
mcRock._x = mcRock._x - mcRock.xMove;
xTotalMove = xTotalMove + mcRock.xMove;
mcMonkey._rotation = mcMonkey._rotation + nRotationCurrentSpeed;
if ((mcMonkeyBumpers._x < 700) && (mcRock.xMove > 0)) {
mcMonkey._rotation = mcMonkey._rotation + nRotationCurrentSpeed;
mcMonkeyBumpers._x = mcMonkeyBumpers._x + mcRock.xMove;
}
} else {
mcTile1._x = mcTile1._x + mcRock.xMove;
xTotalMove = xTotalMove + mcRock.xMove;
if (mcMonkeyBumpers._x < 700) {
mcMonkey._rotation = mcMonkey._rotation + nRotationCurrentSpeed;
mcMonkeyBumpers._x = mcMonkeyBumpers._x + mcRock.xMove;
}
if (mcTile1._x >= xTileStop) {
mcTile1._x = xTileStart;
mcTile1.mcSign1.txtDistance.text = mcTile1.mcSign2.txtDistance.text;
nOldDistance = new Number(mcTile1.mcSign2.txtDistance.text);
nOldDistance = nOldDistance + 50;
mcTile1.mcSign2.txtDistance.text = nOldDistance.toString();
nCurrentThrowDistance = nCurrentThrowDistance + 50;
}
}
mcRock.yMove = mcRock.yMove + yGravity;
if ((mcRock.yMove > yGravityMax) && (mcRock.xMove > 10)) {
mcRock.yMove = yGravityMax;
} else if ((mcRock.yMove > (yGravityMax * 2)) && (mcRock.xMove < 10)) {
mcRock.yMove = yGravityMax * 2;
}
mcRock._y = mcRock._y + mcRock.yMove;
if (mcRock.hitTest(mcThrowOver) || (mcRock._x > (xRockStart + 200))) {
mcRoot.bThrowing = false;
mcRock._visible = false;
ptFlag = mcRoot.convertToStage(mcRock.mcRock);
mcTile1.globalToLocal(ptFlag);
mcTile1.mcFlag._x = ptFlag.x;
mcTile1.mcFlag.gotoAndPlay("up");
mcTile1.mcGrass._x = ptFlag.x;
mcTile1.mcGrass.gotoAndPlay("up");
mcCranky.gotoAndPlay("popup");
mcBubble.gotoAndPlay("popup");
delete mcRock.onEnterFrame;
mcRoot.nLastThrow = mcRoot.round(xTotalMove / 17.1, 2);
if (mcRoot.nLastThrow > mcRoot.nBestThrow) {
mcRoot.nBestThrow = mcRoot.nLastThrow;
}
}
};
}
};
}
function initDistanceBubble(mcBubble) {
var mcMonkeyBumpers = mcRoot.mcHurling.mcMonkeyBumpers;
mcMonkeyBumpers.mcMonkey._rotation = 0;
mcMonkeyBumpers.mcMonkey.mcRock._visible = true;
mcBubble.txtDistance.text = mcRoot.nLastThrow.toString() + " ft.";
mcRoot.mcHurling.txtLast.text = mcRoot.nLastThrow.toString() + " ft.";
mcRoot.mcHurling.txtBest.text = mcRoot.nBestThrow.toString() + " ft.";
mcRoot.setDefaultRollOver(mcBubble.mcHurlAgainBtn);
if (mcRoot.nLastThrow < 25) {
mcBubble.txtComment.text = "Weak! thats...";
}
mcBubble.mcHurlAgainBtn.onRelease = function () {
mcBubble.gotoAndPlay("out");
mcRoot.mcHurling.mcCranky.gotoAndPlay("out");
mcRoot.mcHurling.mcTile1.mcFlag.gotoAndStop("none");
mcRoot.mcHurling.mcTile1.mcGrass.gotoAndStop("none");
mcMonkeyBumpers.onEnterFrame = function () {
this._x = this._x - 20;
if (this._x <= this.xStart) {
this._x = this.xStart;
delete this.onEnterFrame;
}
};
mcRoot.mcHurling.mcTile1.onEnterFrame = function () {
this.mcSign1.txtDistance.text = "0";
this.mcSign2.txtDistance.text = "50";
this._x = this._x - 20;
if (this._x <= this.xStart) {
this._x = this.xStart;
delete this.onEnterFrame;
}
};
};
mcRoot.setDefaultRollOver(mcBubble.mcSiteBtn);
mcBubble.mcSiteBtn.onRelease = function () {
getURL ("http://www.donkeykong.com/kingofswing/", "_blank");
};
}
function initCrankyBubble(mcBubble) {
var mcMonkeyBumpers = mcRoot.mcHurling.mcMonkeyBumpers;
mcMonkeyBumpers.mcMonkey._rotation = 0;
mcMonkeyBumpers.mcMonkey.mcRock._visible = true;
mcRoot.setDefaultRollOver(mcBubble.mcPlayBtn);
mcBubble.mcPlayBtn.onRelease = function () {
mcRoot.gotoAndPlay("game_in");
mcMonkeyBumpers.nFrameCounter = 0;
mcMonkeyBumpers.onEnterFrame = function () {
this.nFrameCounter++;
if (this.nFrameCounter > 30) {
this._x = this._x - 20;
if (this._x <= this.xStart) {
this._x = this.xStart;
delete this.onEnterFrame;
}
}
};
};
}
function initMonkey() {
mcRoot.mcMonkey.onRelease = function () {
mcRoot.gotoAndPlay("game_in");
mcRoot.mcHurling.mcMonkeyBumpers.nFrameCounter = 0;
mcRoot.mcHurling.mcMonkeyBumpers.onEnterFrame = function () {
this.nFrameCounter++;
if (this.nFrameCounter > 30) {
this._x = this._x - 20;
if (this._x <= this.xStart) {
this._x = this.xStart;
delete this.onEnterFrame;
}
}
};
};
}
function convertToStage(mcClip) {
pt = new Object();
pt.x = 0;
pt.y = 0;
mcClip.localToGlobal(pt);
return(pt);
}
function scaleVectorToMag(v, originalMag, targetMag) {
var _local2 = targetMag / originalMag;
v.xMove = v.xMove * _local2;
v.yMove = v.yMove * _local2;
return(v);
}
function dist(x1, y1, x2, y2) {
return(Math.sqrt(dist2(x1, y1, x2, y2)));
}
function dist2(x1, y1, x2, y2) {
return(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
}
function normalize(v) {
var _local2 = dist(0, 0, v.x, v.y);
v.x = v.x / _local2;
v.y = v.y / _local2;
return(v);
}
function round(nNumber, nDecimalPlaces) {
if (nDecimalPlaces > 0) {
var _local1 = Math.pow(10, nDecimalPlaces);
return(Math.round(nNumber * _local1) / _local1);
}
}
function initHurlingEmail(mcEmail) {
mcRoot.mcHurling.mcBubble.tabEnabled = false;
mcRoot.mcHurling.mcBubble.tabChildren = false;
mcRoot.mcHurling.mcBubble.mcFriendBtn.tabEnabled = false;
mcRoot.mcHurling.mcBubble.mcFriendBtn.tabChildren = false;
mcEmail.btnBlocker.useHandCursor = false;
mcRoot.setDefaultRollOver(mcEmail.mcSendBtn);
mcEmail.mcSendBtn.onRelease = function () {
mcRoot.sendHurlingEmail(mcEmail);
};
mcRoot.setDefaultRollOver(mcEmail.mcCloseBtn);
mcEmail.mcCloseBtn.onRelease = function () {
this._parent.gotoAndPlay("close");
};
}
function sendHurlingEmail(mcWindow) {
var _local2 = mcWindow.txtEmail.text;
var _local3 = mcWindow.txtName.text;
var _local4 = "";
var _local7 = true;
if (!mcRoot.verifyHurlingEmail(_local2)) {
mcRoot.showMessage("Please enter a valid email address.");
} else if (_local3.length == 0) {
mcRoot.showMessage("Please enter your first name");
} else {
var _local1 = new LoadVars();
_local1.name = _local3;
_local1.email = _local2;
if (((mcRoot.bMailHighScore == true) && (mcRoot.nBestThrow != undefined)) && (mcRoot.nBestThrow > 0)) {
_local1.distance = mcRoot.nBestThrow;
} else if (((mcRoot.bMailHighScore == false) && (mcRoot.nLastThrow != undefined)) && (mcRoot.nLastThrow > 0)) {
_local1.distance = mcRoot.nLastThrow;
}
var _local5 = new LoadVars();
_local5.onLoad = parseHurlingData;
_local4 = "sendHurlingMailXML.jsp";
_local1.sendAndLoad(_local4, _local5, "POST");
mcWindow.gotoAndPlay("close");
mcRoot.showMessage("sending mail, please wait...");
}
}
function parseHurlingData(bSuccess) {
if (!bSuccess) {
mcRoot.showMessage("There was an error sending your mail, please try again later.");
return(false);
}
delete this.onLoad;
objXML = new XML();
objXML.ignoreWhite = true;
var _local3 = unescape(this.toString());
objXML.parseXML(_local3);
var _local4 = objXML.firstChild;
var _local2 = _local4.firstChild;
if (_local2.nodeName == "STATUS") {
mcRoot.showMessage("Thank you, your e-mail has been sent");
return(true);
}
if ((_local2.nodeName == "ERROR") && (_local2.attributes.CODE == 3)) {
mcRoot.showMessage("Sorry, but your entry contains inappropriate language. Please try again.");
} else {
mcRoot.showMessage("There was an error sending your mail, please try again later.");
}
return(false);
}
function verifyHurlingEmail(sEmail) {
nAtSign = sEmail.indexOf("@");
nPeriod = sEmail.lastIndexOf(".");
if (nAtSign <= 0) {
return(false);
}
if (nPeriod > (sEmail.length - 3)) {
return(false);
}
if ((nPeriod - nAtSign) <= 2) {
return(false);
}
return(true);
}
function setDefaultRollOver(mcBtn) {
mcBtn.enabled = true;
mcRoot.setHitArea(mcBtn);
mcBtn.onRollOver = function () {
this.gotoAndPlay("over");
};
mcBtn.onRollOut = function () {
this.gotoAndPlay("out");
};
mcBtn.onPress = function () {
this.gotoAndPlay("down");
};
mcBtn.onRelease = function () {
this.gotoAndPlay("up");
};
}
function setHitArea(mcClip) {
if (mcClip == null) {
mcClip = this;
}
mcClip.createEmptyMovieClip("mcHitArea", _global.nTopDepth);
_global.nTopDepth++;
var _local4 = mcClip.getBounds();
var _local6 = _local4.xMin;
var _local8 = _local4.xMax;
var _local5 = _local4.yMin;
var _local7 = _local4.yMax;
mcClip.mcHitArea.moveTo(_local6, _local5);
mcClip.mcHitArea.beginFill(0);
mcClip.mcHitArea.lineTo(_local8, _local5);
mcClip.mcHitArea.lineTo(_local8, _local7);
mcClip.mcHitArea.lineTo(_local6, _local7);
mcClip.mcHitArea.lineTo(_local6, _local5);
mcClip.mcHitArea.endFill();
mcClip.mcHitArea._visible = false;
mcClip.hitArea = mcClip.mcHitArea;
}
mcRoot.initHurling();
Frame 43
stop();
mcRoot.initMonkey();
Frame 72
stop();
Symbol 14 MovieClip Frame 2
stop();
Symbol 14 MovieClip Frame 20
if (mcRoot.bThrowing) {
gotoAndPlay ("spin");
}
Symbol 14 MovieClip Frame 25
stop();
Symbol 19 MovieClip Frame 20
stop();
this._parent.gotoAndStop("up");
Symbol 20 MovieClip Frame 20
stop();
this._parent.gotoAndStop("up");
Symbol 21 MovieClip Frame 2
stop();
Symbol 21 MovieClip Frame 18
stop();
Symbol 21 MovieClip Frame 30
stop();
Symbol 26 MovieClip Frame 1
stop();
Symbol 28 MovieClip Frame 1
stop();
Symbol 28 MovieClip Frame 2
stop();
Symbol 28 MovieClip Frame 27
stop();
Symbol 31 MovieClip Frame 2
stop();
Symbol 45 MovieClip Frame 1
stop();
Symbol 47 MovieClip Frame 1
stop();
Symbol 48 MovieClip Frame 1
stop();
Symbol 52 MovieClip Frame 1
stop();
Symbol 52 MovieClip Frame 2
this.btnBlocker.useHandCursor = false;
Symbol 52 MovieClip Frame 13
stop();
Symbol 65 MovieClip Frame 1
stop();
Symbol 65 MovieClip Frame 11
stop();
Symbol 65 MovieClip Frame 18
stop();
Symbol 70 MovieClip Frame 1
stop();
Symbol 70 MovieClip Frame 11
stop();
Symbol 70 MovieClip Frame 18
stop();
Symbol 73 MovieClip Frame 1
stop();
Symbol 73 MovieClip Frame 13
this.gotoAndPlay("distance");
Symbol 73 MovieClip Frame 15
stop();
Symbol 73 MovieClip Frame 25
mcRoot.initDistanceBubble(this);
Symbol 73 MovieClip Frame 26
stop();
Symbol 75 MovieClip Frame 1
stop();
Symbol 93 MovieClip Frame 4
stop();
Symbol 93 MovieClip Frame 10
stop();
Symbol 93 MovieClip Frame 15
stop();
Symbol 97 MovieClip Frame 4
stop();
Symbol 97 MovieClip Frame 10
stop();
Symbol 97 MovieClip Frame 15
stop();
Symbol 102 MovieClip Frame 1
stop();
Symbol 102 MovieClip Frame 11
stop();
Symbol 102 MovieClip Frame 18
stop();
Symbol 104 MovieClip Frame 15
stop();
mcRoot.initCrankyBubble(this);