Combined Code
frame 1 {
function playMe() {
if (_global.sCol == 'red') {
++_global.scoreCountOne;
}
if (_global.sCol == 'green') {
--_global.scoreCountOne;
}
playtimer.timer.oneScore.oneScoreField.text = _global.scoreCountOne;
}
stop();
game.onPress = function () {
playMe();
};
}
movieClip 2 {
frame 1 {
_global.sCol = 'green';
}
frame 4 {
_global.sCol = 'red';
}
frame 7 {
_global.sCol = 'blue';
}
}
button 10 {
on (release) {
nextFrame();
}
}
movieClip 24 {
}
movieClip 33 {
}
movieClip 36 {
}
movieClip 41 {
}
movieClip 42 {
frame 1 {
recordTime = new MovieClip();
MovieClip.registerClass('Gametimer', recordTime);
MovieClip.prototype.recordTime = function (onScore, cDown) {
if (cDown) {
this.secondsField = '00';
this.minField = Math.floor(downTime / 60);
} else {
this.secondsField = '00';
this.minField = '00';
}
count = 0;
_global.scoreCountOne = 0;
_global.scoreCountA = 0;
_global.scoreCountB = 0;
this.oneScore.oneScoreField.text = scoreCountOne;
this.twoScore.aScoreField.text = scoreCountA;
this.twoScore.bScoreField.text = scoreCountB;
if (onScore) {
this.oneScore._visible = true;
this.twoScore._visible = false;
this.oneScore.oneScoreField.text = scoreCountOne;
} else {
this.twoScore._visible = true;
this.oneScore._visible = false;
this.twoScore.aScoreField.text = scoreCountA;
this.twoScore.bScoreField.text = scoreCountB;
}
};
startGame = new MovieClip();
MovieClip.registerClass('StartGame', startGame);
MovieClip.prototype.startGame = function (butStart, cDown, downTime) {
if (butStart == 0) {
this.startBut.enabled = true;
this.stopBut.enabled = true;
this.resetBut.enabled = true;
this.secondBack._visible = false;
this.startBut.onPress = function () {
timer.intTime();
};
} else {
if (butStart == 1) {
this.startBut.enabled = false;
this.stopBut.enabled = false;
this.resetBut.enabled = false;
this.secondBack._visible = true;
this.intTime();
} else {
if (butStart == 2) {
this.startBut.enabled = false;
this.stopBut.enabled = false;
this.resetBut.enabled = true;
this.secondBack._visible = false;
this.countDown(downTime);
} else {
if (butStart == 3) {
this.secondsField = '00';
cDownTime = Math.floor(downTime / 60);
if (cDownTime < 10) {
this.minField = '0' + cDownTime;
} else {
this.minField = cDownTime;
}
this.startBut.enabled = true;
this.stopBut.enabled = true;
this.resetBut.enabled = true;
this.secondBack._visible = false;
this.startBut.onPress = function () {
timer.countDown(downTime);
};
}
}
}
}
};
stopGame = new MovieClip();
MovieClip.registerClass('StopGame', stopGame);
MovieClip.prototype.stopGame = function (autoStop, frameName) {
if (autoStop) {
this.stopBut.enabled = false;
this.onEnterFrame = function () {
if (_root._currentframe == frameName) {
clearInterval(myTimer);
}
};
} else {
this.stopBut.enabled = true;
this.stopBut.onPress = function () {
clearInterval(myTimer);
};
}
};
intTime = new MovieClip();
MovieClip.registerClass('ShowTime', intTime);
MovieClip.prototype.intTime = function () {
myPause = new Object();
myPause.interval = function () {
countMin = Math.floor(count / 60);
countRest = count - countMin * 60;
if (count < 9) {
timer.secondsField = '0' + countRest;
timer.minField = '00';
} else {
timer.secondsField = countRest;
}
if (count < 60) {
timer.minField = '00';
}
if (count >= 60 and count < 600) {
if (count > countMin * 60 and count <= countMin * 60 + 9) {
timer.secondsField = '0' + countRest;
}
timer.minField = '0' + countMin;
}
if (count >= 600) {
timer.minField = countMin;
}
++count;
};
myTimer = setInterval(myPause, 'interval', 1000);
};
countDown = new MovieClip();
MovieClip.registerClass('Countdown', countDown);
MovieClip.prototype.countDown = function (downTime) {
myPause = new Object();
myPause.interval = function () {
countMin = Math.floor(downTime / 60);
countRest = downTime - countMin * 60;
if (downTime == 0) {
clearInterval(myTimer);
}
if (downTime < 9) {
timer.secondsField = '0' + countRest;
timer.minField = '00';
} else {
timer.secondsField = countRest;
}
if (downTime < 60) {
timer.minField = '00';
timer.secondsField = countRest;
}
if (downTime >= 60 and downTime < 600) {
if (downTime > countMin * 60 and downTime <= countMin * 60 - 51) {
timer.secondsField = '0' + countRest;
}
timer.minField = '0' + countMin;
}
if (downTime >= 600) {
timer.minField = countMin;
}
--downTime;
};
myTimer = setInterval(myPause, 'interval', 1000);
};
resetTimer = new MovieClip();
MovieClip.registerClass('Resettimer', resetTime);
MovieClip.prototype.resetTimer = function () {
this.secondsField = '00';
this.minField = '00';
_global.scoreCountOne = 0;
_global.scoreCountA = 0;
_global.scoreCountB = 0;
this.oneScore.oneScoreField.text = scoreCountA;
this.twoScore.aScoreField.text = scoreCountA;
this.twoScore.bScoreField.text = scoreCountB;
count = 0;
};
resetBut = new MovieClip();
MovieClip.registerClass('Resetbutton', resetBut);
MovieClip.prototype.resetBut = function () {
this.resBut.onPress = function () {
timer.secondsField = '00';
timer.minField = '00';
_global.scoreCountOne = 0;
_global.scoreCountA = 0;
_global.scoreCountB = 0;
timer.oneScore.oneScoreField.text = scoreCountOne;
timer.twoScore.aScoreField.text = scoreCountA;
timer.twoScore.bScoreField.text = scoreCountB;
count = 0;
};
};
timer.recordTime(onScore, cDown);
timer.startGame(butStart, cDown, downTime);
timer.stopGame(autoStop, frameName);
timer.resetTimer();
timer.resetBut();
}
}
instance playtimer of movieClip 42 {
onClipEvent (initialize) {
onScore = true;
butStart = 2;
autoStop = false;
frameName = 'defaultValue';
cDown = true;
downTime = 120;
}
}
frame 2 {
stop();
playBut3.onPress = function () {
++_global.scoreCountOne;
mytimer.timer.oneScore.oneScoreField.text = _global.scoreCountOne;
};
mytimer.timer.startGame(1, false, 0);
}
button 45 {
on (release) {
prevFrame();
}
}
button 51 {
on (release) {
nextFrame();
}
}
instance mytimer of movieClip 42 {
onClipEvent (initialize) {
onScore = true;
butStart = 1;
autoStop = true;
frameName = '3';
cDown = false;
downTime = 0;
}
}
frame 3 {
stop();
resetBut.onRelease = function () {
mytimer.timer.resetTimer();
prevFrame();
};
}
frame 4 {
stop();
playBut1.onPress = function () {
++scoreCountA;
sectimer.timer.twoScore.aScoreField.text = scoreCountA;
};
playBut2.onPress = function () {
++scoreCountB;
sectimer.timer.twoScore.bScoreField.text = scoreCountB;
};
}
instance sectimer of movieClip 42 {
onClipEvent (initialize) {
onScore = false;
butStart = 0;
autoStop = false;
frameName = 'defaultValue';
cDown = false;
downTime = 0;
}
}