Is this a bug with ImageSheets?

Hi,

I load my ImageSheet like this:

[lua]

local newTongue = {};

local sheetData =
{
width = 53,
height = 10,
numFrames = 2,

– The params below are optional; used for dynamic resolution support
sheetContentWidth = 106, – width of original 1x size of entire sheet
sheetContentHeight = 10, – height of original 1x size of entire sheet
}

local sequenceData = {
{ name = “start2”, frames={ 1, 2}, time = 250, loopCount = 1 },
}

local mySheet = graphics.newImageSheet(“tongue_left.png”, sheetData );
newTongue = display.newSprite(mySheet, sequenceData)
[/lua]

and play it back like this:

[lua]
newTongue:setSequence(“start2”)
newTongue:play()
[/lua]

Problem is, sprite sheet get’s loaded but won’t animate. Unless I increase frames of the sequence data’s frames to like {1,2,1} or make loopCount to 2 or more. And if I make loopCount to 2, it won’t play the animation back 2 times, it gets played back infinitely!

My image file that I’m loading is sized at 106x10 and has two frames and each frame is 53x10.

What’s the problem?

Thanks. [import]uid: 206803 topic_id: 37379 reply_id: 67379[/import]

Probably problem is highly related to loopCount because if I remove it, it works but when I put it and give it 1, it won’t.

You may think that animation is played back so fast that I can’t see but I press Ctrl+R fast and can’t see a thing. [import]uid: 206803 topic_id: 37379 reply_id: 145571[/import]

Problem was with the animation listener. I accidentally copied my listener from another class and in it I set another animation and play back. Since Corona didn’t complain about this ImageSheet not having that animation, I didn’t notice. Nothing in the terminal.

BTW, I still think there is a problem there with loopCount because with that animation listener there I still can’t get one loop out of my animation and my animation listener doesn’t stop any animation but when it’s there, I can’t get animation to be played back once. Because if it was with the animation listener, it would not work with the loopCount of 2.

[lua]

local function mySpriteListener( event )

if ( event.phase == “ended” ) then

if (event.target.sequence == “MajorChew”) then

numOfMonstersThatDoneChewing = numOfMonstersThatDoneChewing + 1

end

local thisSprite = event.target --“event.target” references the sprite
thisSprite:setSequence( “idle” ) --switch to “fastRun” sequence
thisSprite:play() --play the new sequence; it won’t play automatically!
end

end
[/lua] [import]uid: 206803 topic_id: 37379 reply_id: 145574[/import]

Probably problem is highly related to loopCount because if I remove it, it works but when I put it and give it 1, it won’t.

You may think that animation is played back so fast that I can’t see but I press Ctrl+R fast and can’t see a thing. [import]uid: 206803 topic_id: 37379 reply_id: 145571[/import]

Problem was with the animation listener. I accidentally copied my listener from another class and in it I set another animation and play back. Since Corona didn’t complain about this ImageSheet not having that animation, I didn’t notice. Nothing in the terminal.

BTW, I still think there is a problem there with loopCount because with that animation listener there I still can’t get one loop out of my animation and my animation listener doesn’t stop any animation but when it’s there, I can’t get animation to be played back once. Because if it was with the animation listener, it would not work with the loopCount of 2.

[lua]

local function mySpriteListener( event )

if ( event.phase == “ended” ) then

if (event.target.sequence == “MajorChew”) then

numOfMonstersThatDoneChewing = numOfMonstersThatDoneChewing + 1

end

local thisSprite = event.target --“event.target” references the sprite
thisSprite:setSequence( “idle” ) --switch to “fastRun” sequence
thisSprite:play() --play the new sequence; it won’t play automatically!
end

end
[/lua] [import]uid: 206803 topic_id: 37379 reply_id: 145574[/import]