Hey all,

How can I make a button that looks "grayed out" when it doesn't meet some requirement (like gold).

For example, if i'm on a shop and don't have any gold to buy a item, the button should be greyed out and clicking on it will do nothing.

When you have enough gold, the color returns and the buy button works properly.

Initially, I tried to achieve this with buttons, with help of the following properties:

PHP Code:
if( player doesn't have money to buy item)
{
buyButton.enabled = false;
buyButton.visible = false;
}
else
{
buyButton.enabled = true;
buyButton.visible = true;

While this method works, it isn't perfect. Even if the players don't have gold to buy a item, I would like to have a gray "Buy" button next to the item. That way, players will undertand they don't have gold.

How do you achieve this? With movieclips or is there a function in Actionscript 3.0 that allows your buttons to get this effect?

Thanks.