A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Shop Buy Buttons States

  1. #1
    Senior Member
    Join Date
    Jan 2008
    Posts
    107

    Shop Buy Buttons States

    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.

  2. #2
    Senior Member
    Join Date
    May 2009
    Posts
    138
    I think one of the more common ways is to use a movie clip and switch frames via gotoAndStop().

  3. #3
    Senior Member
    Join Date
    Jan 2008
    Posts
    107
    That's what I thought. But how can I create the mouseover effect in a movieclip (move cursor over button: text/button color changes)? Don't I have to create a function for that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center