Skip to content

Instantly share code, notes, and snippets.

@painquin
Created September 3, 2011 23:16
Show Gist options
  • Save painquin/1191927 to your computer and use it in GitHub Desktop.
Save painquin/1191927 to your computer and use it in GitHub Desktop.
package
{
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.text.Font;
import flash.text.StaticText;
import flash.text.TextField;
/**
* ...
* @author Quinnius
*/
public class MenuButton extends SimpleButton
{
public function MenuButton(text:String)
{
var up:Sprite = new Sprite();
var hov:Sprite = new Sprite();
var down:Sprite = new Sprite();
var t:TextField;
t = new TextField();
t.text = text;
t.textColor = 0;
up.addChild(t);
t = new TextField();
t.text = text;
t.textColor = 0;
hov.addChild(t);
t = new TextField();
t.text = text;
t.textColor = 0;
down.addChild(t);
up.graphics.beginFill(0xDDDDDD, 1);
up.graphics.lineStyle(1, 0);
up.graphics.drawRect(0, 0, t.textWidth + 3, t.textHeight + 3);
up.graphics.endFill();
hov.graphics.beginFill(0xFFFFFF, 1);
hov.graphics.lineStyle(1, 0);
hov.graphics.drawRect(0, 0, t.textWidth + 3, t.textHeight + 3);
hov.graphics.endFill();
down.graphics.beginFill(0xEEEEEE, 1);
down.graphics.lineStyle(1, 0);
down.graphics.drawRect(0, 0, t.textWidth + 3, t.textHeight + 3);
down.graphics.endFill();
super(up, hov, down, up);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment