Author Topic: UIToggle - swapping sprites  (Read 2404 times)

aholla

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 40
    • View Profile
UIToggle - swapping sprites
« on: June 24, 2014, 12:44:41 PM »
Hi, Im trying to swap sprites when the toggle in on or off.

I have a button with 2 child "icon" sprites. On the button I have 2 UIToggles which I set the sprite to one of each icon. I set one of the toggles starting state to true.

Now to control all of this I have Get both of the toggles and compare their "activeSprite" to my own starting sprite so I know which one is the "on" and which is the "off" sprite.

Is there a simpler way to achieve this?

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIToggle - swapping sprites
« Reply #1 on: June 25, 2014, 05:57:01 AM »
Easiest way is to have a background sprite, and have it be covered up by the active sprite. So when the toggle is active, the active sprite will simply cover up the background sprite.