Touch hold causes image to disappear

the below works fine (examples from the director files) when i click (touch) a button and hold it, the image disappears, but when i release, the code finishes working correctly.

The director examples work fine, and I’m basing most of my code of that example…not sure what i’m missing.

[code]
module(…, package.seeall)

– Main function - MUST return a display.newGroup()
function new()
local ui = require(“ui”)

local localGroup = display.newGroup()

– Background
local background = display.newImage(“images/bk-default.png”)
localGroup:insert(background)

– Menu Buttons - Start

local w,h = display.contentWidth, display.contentHeight
local startPosX,startPosY = 160, 230
local aboutButton = nil
local score = 0

local function onAbout ( event )
if event.phase == “release” then
if (score == 0) then
transition.to( aboutButton, { time=500, alpha=1, x=(startPosX), y=(startPosY+50) } )
score = 1
else
transition.to( aboutButton, { time=500, alpha=1, x=(startPosX), y=(startPosY) } )
score = 0
end
end
end

aboutButton = ui.newButton{
defaultSrc = “images/bt_moveFromLeft.png”,
defaultX = 160,
defaultY = 120,
onEvent = onAbout,
id = “aboutButton”,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
emboss = false
}
aboutButton.x = 160
aboutButton.y = 230
aboutButton.isActive = true
localGroup:insert(aboutButton)

– Menu Buttons - End

unloadMe = function()
end

– MUST return a display.newGroup()
return localGroup
end
[/code] [import]uid: 16420 topic_id: 6821 reply_id: 306821[/import]

hey barrytallis,

you’re missing something in your button code:
you need a button-over.png version of your button.png

like this:
[lua]aboutButton = ui.newButton{
defaultSrc = “images/bt_moveFromLeft.png”,
defaultX = 160,
defaultY = 120,
overSrc = “images/bt_moveFromLeft-over.png”, – new code
overX = 44, – new code
overY = 44, – new code
onEvent = onAbout,
id = “aboutButton”,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
emboss = false
}
[import]uid: 12455 topic_id: 6821 reply_id: 23839[/import]

Awesome - thank you!! [import]uid: 16420 topic_id: 6821 reply_id: 24356[/import]