Hi,
I am using object.fill to swap an image on tap. The code executes but the image never gets swapped.
I create the object with:
iwidth = 32
playerImage is the image sheet
params.image is the first image
local object = display.newImageRect( playerImage, params.image, iwidth, iwidth)
object.objTable = “team”
object.myName = object.index
object.objTable[object.index] = object
When I tap an image I call this code:
function swapPlayerImage(index)
if index ~= nil then
tempimage = team[index].image
hasball = team[index].hasball
if (hasball == false) then
showimage = 2
hasball = true
else
showimage = tempimage
hasball = false
end
local fillParam = { type = “image”, sheet = playerImage, frame = showimage}
team[index].fill = fillParam
team[index].hasball = hasball
end
return true
end
I’ve manually substituted the correct image id which is 2, but the image never gets drawn. Am I missing something?
Thanks, Greg