Results 1 to 2 of 2
  1.    #1  
    The documentation on scroller values says you can get the x,y in pixels but I can't seem to figure out how? I know it has to do with the getScrollPosition method but I can't figure out how to get the values. Here is a code example:


    Code:
    var left;
       var top;
    
       this.controller.getSceneScroller().mojo.ScrollPosition(left,top);

    I'm assuming that this should return the x , y value in pixels but instead my scene just hangs. It won't load up even when you press the button with this code in there so I know something isn't correct.

    Thanks
  2. adsllc's Avatar
    Posts
    46 Posts
    Global Posts
    47 Global Posts
    #2  
    Quote Originally Posted by frankos72 View Post
    The documentation on scroller values says you can get the x,y in pixels but I can't seem to figure out how?
    It's called 'left' and 'top' instead of 'x' and 'y'. See below:
    Code:
    var Ofs=this.scroller.mojo.getScrollPosition();
    console.log("X="+Ofs.left+" Y="+Ofs.top);
    I have found things like the following very helpful in figuring out the stuff that the API doesn't quite state correctly:
    Code:
    var Ofs=this.scroller.mojo.getScrollPosition();
    for (each in Ofs)
      console.log(each+"="+Ofs[each]);
    This treats the object as an array, then prints the value of each member. I doesn't work for everything, but it'sa whole lot better than nothing!

Posting Permissions