[Solved] Anim?

I have an Anim in my physics game, but when it starts… it never stops. The anim have to play only once.
Here’s the code, if anyone can see what’s the problem:

  
local function playAnim (event)   
  
myAnim = movieclip.newAnim({"a1.png","c3.png","d4.png","e5.png","f6.png"})  
myAnim.x=display.contentWidth-400  
myAnim.y=display.contentHeight-255  
  
myAnim:play()  
  
myAnim:setLabels{ startFrame=1, endFrame=5 }  
localGroup:insert(myAnim)  
  
end  
  
start:addEventListener("tap", playAnim)   
  

Thanks in advance :slight_smile:
[import]uid: 27760 topic_id: 30218 reply_id: 330218[/import]

Hello,

You have to specify how many times the animation loops, otherwise it wont stop.

Try the following:

[lua]myAnim:setLabels{ startFrame=1, endFrame=5, loop = 1 }[/lua]

More info:
http://developer.coronalabs.com/reference/index/animobjectplay

Edit: Not sure if the above will work or not, if it doesn’t, call it in the myAnim:play

[lua]myAnim:play({loop = 1})[/lua] [import]uid: 62706 topic_id: 30218 reply_id: 121020[/import]

Thanks for your help: I didn’t put “remove=true” [import]uid: 27760 topic_id: 30218 reply_id: 121031[/import]

Hello,

You have to specify how many times the animation loops, otherwise it wont stop.

Try the following:

[lua]myAnim:setLabels{ startFrame=1, endFrame=5, loop = 1 }[/lua]

More info:
http://developer.coronalabs.com/reference/index/animobjectplay

Edit: Not sure if the above will work or not, if it doesn’t, call it in the myAnim:play

[lua]myAnim:play({loop = 1})[/lua] [import]uid: 62706 topic_id: 30218 reply_id: 121020[/import]

Thanks for your help: I didn’t put “remove=true” [import]uid: 27760 topic_id: 30218 reply_id: 121031[/import]