3 Replies Latest reply on Dec 20, 2012 12:04 PM by kglad

    Add touch listener to item in Flash and Toolkit for CreateJS

    jb3521

      I have an item on the Flash stage with an instance name "myCircle". I am trying to add a 'touchstart' listener to it, but it's not working when I export with Toolkit for CreateJS. I've tried the following in the Flash timeline:

       

      /* js

      this.myCircle.addEventListener('touchstart', function(e) {

      e.preventDefault();

      alert("touched");

                }, false);

      */

       

      AND

       

      /* js

      myCircle.addEventListener('touchstart', function(e) {

      e.preventDefault();

      alert("touched");

        }, false);

      */

       

      The following works, but the listener is on the whole page:

       

      /* js

      document.addEventListener('touchstart', function(e) {

      e.preventDefault();

      alert("touched");

        }, false);

      */

       

      Also tried getting the id of the touched item in the document listener -alert(e.target.id), and it always returns 'canvas' no matter what I touch. Any suggestions appreciated.