//creating a function that create random functionality that we can call over and over again
import flash.events.MouseEvent;
update_btn.addEventListener(MouseEvent.CLICK, updateEverything);
random_btn.addEventListener(MouseEvent.CLICK, updateRandomly);
function updateMessage(theMessage):void {
//myTextBox.text = "Renee"; //for when the function used to say updateMessage():void
myTextBox.text = theMessage;
}
function updateEverything(event:MouseEvent):void {
updateMessage(input_txt.text);
}
//now creating the random function
function updateRandomly(event:MouseEvent):void {
var randomNumber:Number = pickRandom(100);
updateMessage(randomNumber);
}
function pickRandom(theRandomRange):Number {
return Math.ceil(Math.random() * theRandomRange);
}
No comments:
Post a Comment