10 Replies Latest reply on Dec 18, 2012 10:07 AM by kglad

    Using JavaScript in the Flash timeline and createJS, trouble referencing item on the stage

    jb3521

      Hello,

       

      Relatively new to JavaScript, so not sure if this is too complicated to pull off in the Flash timeline. I have an item on the stage with the instance name 'myBox'. I am trying to get it to move to the x coordinate of a touch on the iPad. The JS looks like this

       

      /* js

       

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

       

        event.preventDefault();

        var touch = e.touches[0];

        this.myBox.x=touch.pageX;

       

      }, false);

       

      */

       

      Is it possible to reference 'myBox' from inside the function? this.myBox doesn't work when I publish from Toolkit for createJS. I am able to get the x coordinate of the touch event when I try alert(touch.pageX);

       

      Thanks for the help!