I am doing a random number generator with 5 dynamic text. what I want to do is that when showRandom_txt = 1 then the other texts should be equal to zero
//1.
function randomNumbers(min:Number,max:Number) {
var Results:Number=Math.floor(Math.random()*max)+min;
return Results;
}
function randomNumber(){
var Results:Number=Math.floor(Math.random()*(1+1-0))+0;
return Results;
}
//2.
generate_btn.addEventListener(MouseEvent.CLICK, showRandomnumber);
//3.
function showRandomnumber(event:MouseEvent):void{
showRandom_txt.text = randomNumber();
showRandom2_txt.text = randomNumbers(0,9);
showRandom3_txt.text = randomNumbers(0,9);
showRandom4_txt.text = randomNumbers(0,9);
showRandom5_txt.text = randomNumbers(0,9);
}
i am new to AS3 and i would really apreciate your help. thanks
To evaluate equality use the
==operator.This could be tested from the text field, as in:
Perhaps better would be test against numeric type, as in:
Using an if / else implementation:
Using a switch block: