Thursday, 12 April 2012
Corona Hello World 3
local beepSound = audio.loadSound( "beep.caf" )
local textObject = display.newText( "Hello World!", 50, 50, native.systemFont, 24 )
textObject:setTextColor( 255,255,255 )
local button = display.newImage( "button.png" )
button.x = display.contentWidth / 2
button.y = display.contentHeight - 50
function button:tap( event )
local r = math.random( 0, 255 )
local g = math.random( 0, 255 )
local b = math.random( 0, 255 )
textObject:setTextColor( r, g, b )
audio.play( beepSound )
end
button:addEventListener( "tap", button )
transition.to( textObject, { time=1000, y=textObject.y+100 } )
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment