Author Topic: FlxButtons are driving me nuts!  (Read 975 times)

Minverva

  • Active Member
  • ***
  • Posts: 126
  • Karma: +0/-0
    • View Profile
FlxButtons are driving me nuts!
« on: Sat, Sep 7, 2013 »
This shouldn't be this difficult, but this works:

playbutton.loadText(new FlxText(0, 0, 100, "go"));

But this doesn't work:

playtext = new FlxText(0, 0, 100, "Go");         
playbutton = new FlxButton(300, 300, startmission);
playbutton.loadText(playtext, playtext);

I'm using Flixel 2.34 - what the hell is the problem? I can't seem to get the text on it the second way, and I need to do it the second way (I think) so I can change the color and stuff.

Minverva

  • Active Member
  • ***
  • Posts: 126
  • Karma: +0/-0
    • View Profile
Re: FlxButtons are driving me nuts!
« Reply #1 on: Sat, Sep 7, 2013 »
Oh if anyone is curious you can't use the same FlxText for both the highlight and non-highlight.

ywp

  • Member
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
Re: FlxButtons are driving me nuts!
« Reply #2 on: Mon, Sep 9, 2013 »
You're right.  I usually do something like the following (in a loop for multiple buttons):

Code: [Select]
text1 = new FlxText(0, 0, 100);
text1.setFormat("GO!", 16, 0xFF6e8a87);
text2 = new FlxText(0, 0, 100);
text2.setFormat("GO!", 16, 0xFF98836b);
button.loadText(text1, text2);