Continuous feedback button

  • Here is a way to monitor a state of a button
    • The variable pressing keeps track of whether the button is being pressed or released.
    • var pressing:Boolean = false;
      button_btn.addEventListener(MouseEvent.MOUSE_DOWN,
      pressdown)
      function pressdown(myevent:MouseEvent):void{
      pressing = true;
      }
  • How would you set a release to false?
  • How would you evaluate the code
    • hint - fill in what's missing:
      stage.addEventListener(Event.ENTER_FRAME, contaction)
      function contaction(myevent:Event):void{
      trace ("Your pressing the button");
      }
< >