I want to add a button(s) which on add to certain variebles such as my time.
heres my code: (to big to upload)
var questions:Array = new Array(["What is as big as you are and yet does not weigh anything? ", "shadow"], ["You can hold it without using your hands or arms. What is it? ", "breath"], ["What gets wetter and wetter the more it dries?", "towel"]);//quesion array
var score:Number;
var round:Number;
var attempts:Number;
var gameOver:Boolean;
shuffle = function (targetArray) { for (i=0; i<targetArray.length; i++) {var tmp = targetArray*;var randomNum = random(targetArray.length);targetArray* = targetArray[randomNum];targetArray[randomNum] = tmp;}
};
function nextround() {
attempts = 0;
result_txt.text = "";
if (round<questions.length+1) {
question_txt.text = "Riddle "+round+": "+questions[round-1][0];
} else {
question_txt.text = "Game Over!";
gameOver = true;
check_btn.inner_txt.text = "Play Again";
}
}
function gameInit() {
check_btn.inner_txt.text = "Check";
gameOver = false;
score = 0;
round = 1;
shuffle(questions);;
nextround();
score_txt.text = "Points: "+score;
}
check_btn.onRelease = function() {
if (!gameOver) {
if (questions[round-1][1] == input_txt.text) {
score++;
score_txt.text = "Points: "+score;
question_txt.text = "";
input_txt.text = "";
round++;
setTimeout(nextround,1000);;
} else {
result_txt.text = "Incorrect try again";
input_txt.text = "";
attempts++;
if (attempts>=3) {
question_txt.text = "Too many mistakes - Game Over!";
result_txt.text = "";
gameOver = true;
check_btn.inner_txt.text = "Play Again";
}
}
} else {
gameInit();
}
};
gameInit();__root.timer("timer",_root.getNextHighestDepth(),5,0,100,25);;// Timer code starts from here
_root.myMinutes = 120;//set starting minutes
_root.mySeconds = 0;//set startnig seconds
_root.timer.text = twoDigitString(myMinutes)+":"+twoDigitString(mySeconds);
function updateTimer() {
if (_root.mySeconds == 0) {
if (_root.myMinutes == 0) {
_root.timer.text = " up!";// displayed when timer is fin
clearInterval(myInterval);;
delete myInterval;
} else {
_root.myMinutes = _root.myMinutes-1;
_root.mySeconds = 59;
_root.timer.text = twoDigitString(myMinutes)+":"+twoDigitString(mySeconds);
}
} else {
_root.mySeconds = _root.mySeconds-1;
_root.timer.text = twoDigitString(myMinutes)+":"+twoDigitString(mySeconds);
}
}
// This function will make sure we have two number places in our number if it's less then 9(0#)
function twoDigitString(myNumber) {
myTemp = String(myNumber);
if (myTemp.length == 1) {
myTemp = "0"+myTemp;
}
return myTemp;
}
//custom curser
myInterval = setInterval(updateTimer, 1);
Mouse.hide();
customCursor_mc.onMouseMove = function():Void {
this._x = _xmouse;
this._y = _ymouse;
updateAfterEvent();
}
var cm:ContextMenu = new ContextMenu();
this.menu = cm;
cm.onSelect = function():Void {
Mouse.hide();
}