why does actionscript mess up strings
import flash.utils.Timer;
import flash.events.MouseEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
var nCount: Number = 0;
var saying: String = (" welcome to the game");
var warning: String = (" Hurry 5 seconds till next question! ");
var ending: String = (" time has run out hope you had fun");
var score: Number = 0;
var answer: String = ("red square");
var answer2: String = ("blue polygon");
var answer3: String = ("green circle");
var answer4: String = ("gray triangle");
var userInput: String;
var shapes: Array = [sqr_mc, tri_mc, cir_mc, poly_mc];
var myTimer: Timer = new Timer(1000, nCount);
guess_txt.border = true;
var audio: Sound = new Mission();
var channel: SoundChannel = new SoundChannel();
timer_txt.text = nCount.toString();
myTimer.start();
timer_txt.border = true;
score_txt.border = true;
myTimer.addEventListener(TimerEvent.TIMER, count);
function count(e: TimerEvent): void {
nCount++;
timer_txt.text = ("Time:" + nCount.toString());
if (nCount == 1) {
response_txt.text = (saying);
} else if (nCount == 5) {
ques_txt.text = "What is color and shape shown ?";
} else if (nCount == 10) {
myTimer.stop();
response_txt.text = (ending);
channel.stop();
}
}
guess_btn.addEventListener(MouseEvent.CLICK, testInput);
function testInput(e: MouseEvent) {
userInput = guess_txt.text;
if (userInput == answer || userInput == answer2 || userInput == answer3 || userInput == answer4) {
response_txt.text = "correct";
score += 10;
score_txt.text = ("Score:" + score.toString());
} else if (userInput != answer || userInput != answer2 || userInput != answer3 || userInput != answer4) {
response_txt.text = "incorrect Try again. ";
score -= 5;
score_txt.text = (score.toString());
}
}
reset_btn.addEventListener(MouseEvent.CLICK, resetGame);
function resetGame(e: MouseEvent) {
nCount = 0;
myTimer.reset();
timer_txt.text = ("Time:" + nCount.toString());
channel.stop();
score = 0;
score_txt.text = ("Score:" + score.toString());
}
play_btn.addEventListener(MouseEvent.CLICK, playGame);
function playGame(e: MouseEvent) {
myTimer.start();
timer_txt.text = ("Time:" + nCount.toString());
}
audio_btn.addEventListener(MouseEvent.CLICK, playAudio);
function playAudio(e: MouseEvent) {
var audio: Sound = new Mission();
var channel: SoundChannel = new SoundChannel();
channel = audio.play()
}
i have that code and when i test my movie action script messes up the strings and only displays i o u and a's .. can any one help
