-
-
Save chinoto/ebe9ce17ad6dd5d765b06f4236a2262a to your computer and use it in GitHub Desktop.
This file contains 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
var | |
tabris=require('tabris') | |
,page=new tabris.Page({ | |
topLevel:true, | |
title:"myapp" | |
}) | |
,pain=0 | |
,grumpy; | |
new tabris.Button({ | |
id:'magicButton', | |
left:10, | |
top:10, | |
text:"Press Me!", | |
}).on('select',function(){ | |
this.set("text","Ouch!!"+(++pain)); | |
}).appendTo(page); | |
grumpy=new tabris.TextView({ | |
layoutData:{centerX:0,centerY:0}, | |
text:"Hey!" | |
id:"voice", | |
}).appendTo(page); | |
if(pain>10){ | |
//yell at me | |
grumpy.set("text","DUDE ENOUGH!"); | |
}else if(pain>5){ | |
//raise voice | |
}else if(pain>2){ | |
//cut it | |
} | |
page.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment