Jump to content

Button Background Color

Dead Pool

Recommended Posts

You can create the button as a graphics object and create text on top of it, put them in a group and then add click handlers to that group

      var buttonelement = [];
      buttonelement.push(game.add.graphics(0, 0));
      buttonelement.push(game.add.text(0, 0, text, textstyle));
      buttonelement[0].beginFill(color, 1);

    group.x = x;
    group.y = y;
    group.onChildInputOver.add(this.onOver, game);
    group.onChildInputOut.add(this.onOut, game);
    group.onChildInputDown.add(this.onClick, game);


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...