1 Reply Latest reply on May 12, 2013 9:27 PM by kglad

    Can I use a global variable to determine event?

    John Locke 2013 Level 1

      If I want to switch between using MouseEvents or TouchEvents, can I use a global variable to switch between the two?

       

      For example,

       

      var myEvent:String = new String();

       

      myEvent = "MouseEvent.MOUSE_UP" ;

      // myEvent = "TouchEvent.TOUCH_TAP" ;

       

      myObject.addEventListener(myEvent, doFunction);

       

      This does not work, but was wondering if there was a correct way to accomplish this so that I could switch between input modes easily when testing across different devices?