Hum.
In fact the problem is due to a very naughty code I’ve made.
In order to change animation when touch event, I made this (global variable is just for example) :
local hgSequence = {
{ name="Anim1", start = 1, count = 15, time = 500},
{ name="Anim2", start = 1, count = 8, time = 500},
}
local tmpSheet= graphics.newImageSheet("Anim1.png", {width = 128, height = 180, numFrames = 15})
_G.anim = display.newSprite(tmpSheet, hgSequence);
_G.anim.x = 150
_G.anim.y = 400
_G.anim:setSequence("Anim1");
_G.anim:play();
local btn = display.newCircle(display.contentCenterX, display.contentCenterY, 20)
function btn:touch(event)
if event.phase == "began" then
display.remove(_G.anim);
local tmpSheet= graphics.newImageSheet("Anim2.png", {width = 128, height = 180, numFrames = 8})
_G.anim = display.newSprite(tmpSheet, hgSequence);
_G.anim.x = 150
_G.anim.y = 400
_G.anim:setSequence("Anim2");
_G.anim:play();
end
end
btn:addEventListener("touch", btn)
I remove the _G.anim of the display object list and when I creating it again, the warning occured, due to the different number of frame of the new animation !
Maybe I should create different newSprite object in different variable and use isVisible property to display the correct animation. It could be nicer