Created
September 27, 2012 03:48
-
-
Save mattcolman/3792055 to your computer and use it in GitHub Desktop.
Clickable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# turn a DisplayObject 'coin' into a Clickable object | |
coin = @bitmap 'coin' | |
coin.centreRegistrationPoint() | |
coin.x = coin.y = 300 | |
@stage.addChild coin | |
@clickable = @makeClickable coin, {over: @bitmap('coin_light'), down: @bitmap('coin_dark')} | |
@clickable.on 'click', @handleClick | |
# use the SimpleButton class to create...a simple button | |
simpleButton = @addActor 'simpleButton', SimpleButton, @stage, @animation('ok_button'), {x: 900, y:200, useRollover: true} | |
simpleButton.on 'click', (e, clickable, button) => | |
console.log 'clicked', e, clickable, button | |
# Make a resizeable button using the UIButton class | |
b = @addActor 'uibutton', UIButton, @stage, text = "resizable button", w = 300, h = 200, options = {useRollover: true, x: @safeD.x + 500, y: 300} | |
b.on 'click', (e, actor) => | |
console.log 'clicked', e, actor | |
handleClick: (e, clickable) => | |
console.log 'clicked', e, clickable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment