/** * Creates a new <code>FlxButton</code> object with a gray background and a * callback function on the UI thread. * * @param X The X position of the button. * @param Y The Y position of the button. * @param Label The text that you want to appear on the button. * @param OnClick The function to call whenever the button is clicked. */ public FlxButton(float x = 0, float y = 0, String label = null, FlxButtonEvent Callback = null) : base(x, y) { if (label != null) { Label = new FlxText(x - 1, y + 3, 80, label); Label.setFormat(null, 8, new Color(0x33, 0x33, 0x33), "center", Color.Transparent); LabelOffset = new FlxPoint(-1, 3); } loadGraphic(ImgDefaultButton, true, false, 80, 20); _callback = Callback; /* * onUp = OnClick; * * onDown = null; * onOut = null; * onOver = null; */ SoundOver = null; SoundOut = null; SoundDown = null; SoundUp = null; Status = Normal; _onToggle = false; _pressed = false; _initialized = false; }
/** * Creates a new <code>FlxButton</code> object with a gray background and a * callback function on the UI thread. * * @param X The X position of the button. * @param Y The Y position of the button. * @param Label The text that you want to appear on the button. * @param OnClick The function to call whenever the button is clicked. */ public FlxButton(float x = 0, float y = 0, String label = null, FlxButtonEvent Callback = null) : base(x, y) { if(label != null) { Label = new FlxText(x-1, y+3, 80, label); Label.setFormat(null, 8, new Color(0x33,0x33,0x33), "center", Color.Transparent); LabelOffset = new FlxPoint(-1, 3); } loadGraphic(ImgDefaultButton, true, false, 80, 20); _callback = Callback; /* onUp = OnClick; onDown = null; onOut = null; onOver = null; */ SoundOver = null; SoundOut = null; SoundDown = null; SoundUp = null; Status = Normal; _onToggle = false; _pressed = false; _initialized = false; }