Alternatives

  • if/else statements
    • if (daytime){
      gotoWork();
      }else{
      gotoSleep();
      }
  • Example
    • stage.addEventListener(KeyboardEvent.KEY_DOWN, detectText);
      function detectText(myevent:KeyboardEvent):void{
      if (myevent.keyCode==89){
      answer_txt.text="correct!";
      }
      }
  • Test by typing "y" when you compile
  • what happens when you type the wrong key?
  • How would you fix it?
< >