Author Topic: Need help with clicking on arrow to shoot to next item in scroll view  (Read 2574 times)

sti4thewin

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Right now I have a scroll view with draggable icons for my color selector. What I'm trying to achieve is to let the player either drag to pick color or have the option to click on arrow to automatically move to next item in scroll view.

I have the scroll view showing only one color at a time, and the dragging is working fine. I just don't know where to start to implement a button (Arrow) that on click, springs to the next color.

btw my icons are all in a grid within the scroll view set up horizontally.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Need help with clicking on arrow to shoot to next item in scroll view
« Reply #1 on: April 12, 2014, 05:05:28 AM »
UICenterOnChild script has a threshold you can set (Next Page Threshold). It's used to make it possible to flick in a direction of desired movement and have it navigate to the next item (ideal usage: each item being a page). In your case you would be doing something similar. Look at how it's used in the UICenterOnChild's Recenter() function -- it calculates the closest child, then finds the second closest one in the direction of desired movement. It then centers on that second child.