Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: bach on August 21, 2014, 08:09:54 AM

Title: Invisible UIButton that can still be clicked
Post by: bach on August 21, 2014, 08:09:54 AM
I need to setup an invisible UIButton that when pressed,
I display a sprite to show that it's been touched.

When I set the Alpha to 0 in Colors > Normal
The click event no longer fires.

Is there a way to have the
Normal Sprite transparent
Pressed Sprite Visible
and still have the Click event firing?

thanks



Title: Re: Invisible UIButton that can still be clicked
Post by: kobilica on August 21, 2014, 08:45:22 AM
Set alpha to 1, it won't be visible but it will work :)
Title: Re: Invisible UIButton that can still be clicked
Post by: slumtrimpet on August 21, 2014, 11:57:38 AM
alpha == .001 should still fire event and be invisible
Title: Re: Invisible UIButton that can still be clicked
Post by: kobilica on August 21, 2014, 12:18:26 PM
Oh correct, I forgot alpha is from 0 - 1.. I am used to 0 - 255
Title: Re: Invisible UIButton that can still be clicked
Post by: bach on August 21, 2014, 05:49:06 PM
Thanks guys, you're both right.

In my case i have set the Alpha for the Normal Color to 1 (hex color)
that made it invisible and still picked up the touch. Thanks for the tip

For the pressed State I kept it's Color Alpha to 255
works great thanks again!