Button is a project mainly written in JAVASCRIPT and ACTIONSCRIPT, based on the WTFPL license.
Simple button manager.
Simple button manager. Easy to handle button interactions separated from the view with just a few lines of code.
Thanks to Mauro de Tarso for helping me with the API.
enable
- Enable interaction.disable
- Disable interaction.reset
- Reset Button.view
- Button view.hit
- Button hit.hasView
- To know if the button has view or not.onRollOver
- Roll over setter (you can set as much as you want).onRollOut
- Roll out setter (you can set as much as you want).onClick
- Click setter (you can set as much as you want).onDoubleClick
- Double click setter (you can set as much as you want).dispose
- Clear from memory.var rectangle : Sprite = new Sprite;
rectangle.graphics.beginFill(0xCC0000);
rectangle.graphics.drawRect(0, 0, 150, 50);
rectangle.graphics.endFill();
addChild(rectangle);
var button : Button = new Button(rectangle);
button.onRollOver = over;
button.onRollOut = out;
button.onPress = press;
button.onClick = click;
button.onDoubleClick = double;
function over( p_button : Button ) : void {
trace("over");
}
function out( p_button : Button ) : void {
trace("out");
}
function press( p_button : Button ) : void {
trace("press");
}
function click( p_button : Button ) : void {
trace("click");
}
function double( p_button : Button ) : void {
trace("double");
}
Check the examples.
For a complete code reference, check the documentation.
WTFPL