Sorry for the language. I’m ary from Indonesia
Please help me…
I have made a button using the UI Library. However, after the button is on the Corona Simulator, no part of these buttons can be touched and can not be touched. Can you explain what happened?
this is my shortcode of homescreen.lua
new = function ()
print( “HomeScreen Started” )
– ANIMATION SUSPEND
local tSuspend
local function onSuspendResume( event )
if “applicationSuspend” == event.type then
tSuspend = system.getTimer()
elseif “applicationResume” == event.type then
– add missing time to tPrevious
tPrevious = tPrevious + ( system.getTimer() - tSuspend )
end
end
Runtime:addEventListener( “system”, onSuspendResume )
– Creating Display Group
local localGroup = display.newGroup()
local buttonGroup = display.newGroup( )
– Function Button
local myTouchListener = function( event )
print( "object touched = "…tostring(event.x) ) --‘event.target’ is the touched object
return true --prevents touch propagation to underlying objects
end
– Defining Button Home Sprite –
local sheetInfo = require(“images.animations.tombolAksara.tombolAksara”) – lua file that Texture packer published
local HomeButtonSheet = graphics.newImageSheet( “images/animations/tombolAksara/tombolAksara.png”, sheetInfo:getSheet() )
– Home Belajar Button
bt_belajar = ui.newButton({
defaultSrc = display.newImage(HomeButtonSheet, sheetInfo:getFrameIndex(“AksaraDasar”)),
defaultX = 309,
defaultY = 255,
overSrc = display.newImage(HomeButtonSheet, sheetInfo:getFrameIndex(“AksaraDasarHover”)),
overX = 309,
overY = 255,
onEvent = myTouchListener,
id = “tombolBelajar”,
})
bt_belajar.anchorX = 0
bt_belajar.anchorY = 1
bt_belajar.x = display.contentWidth -200
bt_belajar.y = display.contentHeight -200
– INSERTING –
localGroup:insert(buttonGroup)
– DEBUGGING –
print( display.pixelWidth / display.actualContentWidth )
return localGroup
end