Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // When the button btnTest is clicked the displayTest function is called
- btnTest.addEventListener(MouseEvent.CLICK, displayTest);
- // When the mouse is clicked inside "txtinNumber1" the clearLabels function is called
- txtinNumber1.addEventListener(MouseEvent.CLICK, clearLabels);
- // e:MouseEvent or KeyDown - click or keyboard event experienced by the button
- // void - the function does not return a value
- function displayTest(e:MouseEvent):void {
- HELP HERE -------------------
- // If the ENTER key is pushed on the keyboard the displayTest function will be called
- key.removeListener(btnTest);
- this.onKeyDown = function() {
- if (key.isDown(key.ENTER)) {
- // action here
- }
- };
- key.addListener(btnTest);
- // declare the variable
- var number1:int;
- var key:
- // This is the clearLabels function
- // e:MouseEvent - click event experienced by the textinput
- // void - the function does not return a value
- function clearLabels(e:MouseEvent):void {
- txtinNumber1.text = "";
- lblAnswer.text = "";
- // get the numbers from the user
- number1 = Number(txtinNumber1.text);
- if (number1 == 18) {
- lblAnswer.text = "You may purchase alcohol in Alberta, Manitoba and Quebec." }
- if (number1 <= 19) {
- lblAnswer.text = "You may purchase alcohol in all parts of Canada." }
- if (number1 > 18) {
- lblAnswer.text = "You may NOT purchase alochol in Canada." }
- }
- }
Add Comment
Please, Sign In to add comment