Author Topic: Move label with button press  (Read 3082 times)

cplusplus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Move label with button press
« on: August 04, 2014, 03:41:45 AM »
Hi,

I have a problem with a button.
My button contains a label. When I press the button, the image looks "pushed" down, so that the optical bounds move 4px down, but of course the real bounds do not change.
I tried to move the label 4px down via Tween on -> press-true and reverse via press-false.
But that works not as intended, it moves down the first time, and then it's moves unpredictable, but I don't know why.
Baking the text or images into the Button is no option, as I have too many.
Any help?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Move label with button press
« Reply #1 on: August 04, 2014, 11:06:51 AM »
Just make the label a child of the sprite you're moving, then any changes to the sprite's position will automatically affect the label. Or are you not actually moving the sprite, and simply changing it to another one that looks pressed down? If so, use UIButtonOffset component. Choose the target to be the label and the Duration to be 0 so that it's instant.

cplusplus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Move label with button press
« Reply #2 on: August 05, 2014, 09:17:20 AM »
UIButtonOffset was the solution. THX