I showed this example in another post recently which doesn’t exactly “point” to the image files used for the button, but shows how you can create another display object, “link” it to the button, and then take actions on that object when the button is manipulated.
[lua]
local function handleButtonEvent( event )
if ( event.phase == “began” ) then
event.target.buttonRect:setFillColor(0.7,0.1,0.2)
elseif ( event.phase == “ended” ) then
event.target.buttonRect:setFillColor(1,0,0)
end
end
local myButton = widget.newButton
{
left=240,
top=100,
width = 240,
height = 120,
label = “button”,
labelColor = { default={1,1,1}, over={0,0,0,1} },
fontSize = 30,
onEvent = handleButtonEvent
}
local bv = myButton._view
myButton.buttonRect = display.newRect( bv.x, bv.y, bv.width, bv.height )
myButton.buttonRect:setFillColor(1,0,0)
myButton.buttonRect:toBack()
myButton.buttonRect.x = myButton.x
myButton.buttonRect.y = myButton.y
[/lua]
This example puts a basic vector rectangle behind the text-only button and toggles its color upon press/unpress. However, that rectangle could be an image that a tint could be set on, or in @keystagefun’s case, it could be a sprite object that you change the frame of to swap which image appears at different times on press.
@keystagefun, even if you had access to the internal default and over images, you probably couldn’t change the over image between several options, since it’s just one non-sprite image and you can’t change the texture on it directly. I suppose you could change the fill parameter and specify which texture to use for the fill, but that gets a bit complex and I think maybe the above solution is more elegant for your needs.
Hope this helps,
Brent