Author Topic: Can't get full range scroll bar using a simple sprite  (Read 5884 times)

Dennis_N

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Can't get full range scroll bar using a simple sprite
« on: January 30, 2014, 11:18:53 AM »
I am trying to setup a scroll bar item following closely the demo scene example, which however uses a sliced sprite. Mine is just a non sliceable graphic that is shorter than the background of the scroll bar. I'm having a hard time making it slide the whole range of the background sprite. It just uses a fraction of that range for whatever reason. Please help me figure this out.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can't get full range scroll bar using a simple sprite
« Reply #1 on: January 30, 2014, 12:15:56 PM »
Some pictures of what you're trying to do would help me understand what you mean.

Dennis_N

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: Can't get full range scroll bar using a simple sprite
« Reply #2 on: January 30, 2014, 12:51:08 PM »
I can't post specific stuff due to NDA.
Lets say you load Scroll View (Panel) scene.
And replace the foreground target object on the scroll bar, with a different sprite from the NGUI sprites. Lets say a smiley. By default it will stretch to the length of 720 which will make it look weird, but it will still run the length of the scroll bar.
However any try to scale it down to proper proportions, will also scale down the length that it runs on the scroll bar.
So how can you possibly accommodate different size sprites and keep the same range?

Dennis_N

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: Can't get full range scroll bar using a simple sprite
« Reply #3 on: January 30, 2014, 02:09:21 PM »
Ok. I finally realized that that script (uiscroll bar) assigns a dynamic length to the slider, that is controlled by the size of the inventory it controls. I had to delete some inventory items to figure it out.
Is there a way to leave the slider length unaffected by the inventory size?
« Last Edit: January 30, 2014, 02:19:42 PM by Dennis_N »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can't get full range scroll bar using a simple sprite
« Reply #4 on: January 31, 2014, 12:32:26 PM »
You could use a UISlider instead of a UIScrollBar.