Button Class
Built-in behaviour that handles OVER/OUT/CLICK events from mouse.
May be appended to any DisplayObject, by behave
method.
Constructor
Button
()
Example:
play = new Joy.DisplayObject(...);
// Append Button behavior into a HUD instance.
play.behave(Joy.Behaviour.Button);
// Bind event handlers
play.bind(Joy.Events.CLICK, function() {
console.log("Mouse is mine!");
})
play.bind(Joy.Events.MOUSE_OVER, function() {
console.log("Mouse is mine!");
})
play.bind(Joy.Events.MOUSE_OUT, function() {
console.log("Mouse is leaving me!");
})