Jump to content

Button Background Color


Dead Pool
 Share

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);
      buttonelement[0].drawRoundedRect(x,y,width,height);
      buttonelement[0].endFill();

    group.addMultiple(buttonelement);
    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

 Share

  • Recently Browsing   0 members

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