sprite.newAnim

Hi Folks,

I am getting an error message on using local myAnim = sprite.newAnim{} – I have images in the table
attempt to call field ‘newAnim’ (a nil value)
stack traceback:
[C]: in function ‘newAnim’

Any ideas what this error is

Thanks [import]uid: 120979 topic_id: 21015 reply_id: 321015[/import]

I think you’re confusing sprites and movie clips. There is no sprite.newAnim() API call. If you’re using movieclip:

local movieclip = require("movieclip")  
  
local myAnim = movieclip.newAnim({"image1.png", "image2.png", "image3.png"})  
  

But for sprite sheets is more like:

local sheet1 = sprite.newSpriteSheet( "runningcat.png", 512, 256 )  
local spriteSet1 = sprite.newSpriteSet(sheet1, 1, 8)  
sprite.add( spriteSet1, "cat", 1, 8, 1000, 0 ) -- play 8 frames every 1000 ms  
local instance1 = sprite.newSprite( spriteSet1 )  
instance1:prepare("cat")  
instance1:play()  
  

See: http://developer.anscamobile.com/reference/index/sprite [import]uid: 19626 topic_id: 21015 reply_id: 82965[/import]

Hi robmiracle

I tried this

[lua]local myAnim = movieclip.newAnim({“images/glow/house_glow0001.png”, “images/glow/house_glow0002.png”, “images/glow/house_glow0003.png”, “images/glow/house_glow0004.png”, “images/glow/house_glow0005.png”, “images/glow/house_glow0006.png”, “images/glow/house_glow0007.png”, “images/glow/house_glow0008.png”, “images/glow/house_glow0009.png”, “images/glow/house_glow0010”})[/lua]

Got the following error
movieclip.lua:43: ERROR: table expected. If this is a function call, you might have used ‘.’ instead of ‘:’
stack traceback:
[C]: ?
[C]: in function ‘insert’
movieclip.lua:43: in function ‘newAnim’
main.lua:23: in main chunk
[import]uid: 120979 topic_id: 21015 reply_id: 82975[/import]

you missed a .png on the last image file.

[import]uid: 19626 topic_id: 21015 reply_id: 82978[/import]