[Resolved] anyone spot the issue in this code using "display.newSprite"???

I am getting:
“Runtime error: bad argument #1 to ‘_newSprite’ (ImageSheet expected, got userdata)” on the “display.newSprite”

Any ideas why? Background: trying to get the TexturePacker code working with Corona

 local sheetData = require "citroen-2cv"  
 local data = sheetData.getSpriteSheetData()  
 local spriteSheet = sprite.newSpriteSheetFromData( "citroen-2cv-texture.png", data )  
 print("spriteSheet", spriteSheet)  
  
 local sequenceData = {   
 name="manual",   
 start=1,   
 count=8  
 -- time=100, -- Optional. In ms. If not supplied, then sprite is frame-based.   
 -- loopCount = 0 -- Optional. Default is 0 (loop indefinitely)   
 -- loopDirection = "bounce" -- Optional. Values include: "forward","bounce"   
 }  
 local car1 = display.newSprite( spriteSheet, sequenceData ) -- ERROR HERE (Runtime error: bad argument #1 to '\_newSprite' (ImageSheet expected, got userdata))  

citroen-2cv-texture.png

local SpriteSheet = {} SpriteSheet.getSpriteSheetData = function () return { frames = { { name = "citroen-2cv-1.png", spriteColorRect = { x = 0, y = 0, width = 472, height = 200 }, textureRect = { x = 0, y = 0, width = 472, height = 200 }, spriteSourceSize = { width = 472, height = 200 }, spriteTrimmed = false, textureRotated = false }, { name = "citroen-2cv-2.png", spriteColorRect = { x = 0, y = 0, width = 472, height = 200 }, textureRect = { x = 472, y = 0, width = 472, height = 200 }, spriteSourceSize = { width = 472, height = 200 }, spriteTrimmed = false, textureRotated = false }, { name = "citroen-2cv-3.png", spriteColorRect = { x = 0, y = 0, width = 472, height = 200 }, textureRect = { x = 0, y = 200, width = 472, height = 200 }, spriteSourceSize = { width = 472, height = 200 }, spriteTrimmed = false, textureRotated = false }, { name = "citroen-2cv-4.png", spriteColorRect = { x = 0, y = 0, width = 472, height = 200 }, textureRect = { x = 472, y = 200, width = 472, height = 200 }, spriteSourceSize = { width = 472, height = 200 }, spriteTrimmed = false, textureRotated = false }, { name = "citroen-2cv-5.png", spriteColorRect = { x = 0, y = 0, width = 472, height = 200 }, textureRect = { x = 0, y = 400, width = 472, height = 200 }, spriteSourceSize = { width = 472, height = 200 }, spriteTrimmed = false, textureRotated = false }, { name = "citroen-2cv-6.png", spriteColorRect = { x = 0, y = 0, width = 472, height = 200 }, textureRect = { x = 472, y = 400, width = 472, height = 200 }, spriteSourceSize = { width = 472, height = 200 }, spriteTrimmed = false, textureRotated = false }, { name = "citroen-2cv-7.png", spriteColorRect = { x = 0, y = 0, width = 472, height = 200 }, textureRect = { x = 0, y = 600, width = 472, height = 200 }, spriteSourceSize = { width = 472, height = 200 }, spriteTrimmed = false, textureRotated = false }, { name = "citroen-2cv-8.png", spriteColorRect = { x = 0, y = 0, width = 472, height = 200 }, textureRect = { x = 0, y = 800, width = 472, height = 200 }, spriteSourceSize = { width = 472, height = 200 }, spriteTrimmed = false, textureRotated = false }, } } end return SpriteSheet [import]uid: 140210 topic_id: 28508 reply_id: 328508[/import]

got it - need this to convert from the old way to the new way:

 local options =  
 {  
 spriteSheetFrames = data.frames  
 }  
 local imageSheet = graphics.newImageSheet( "citroen-2cv-texture.png", options )  

as mentioned here:

http://www.coronalabs.com/blog/2012/03/06/image-sheets-image-groups-and-sprites/

[import]uid: 140210 topic_id: 28508 reply_id: 115000[/import]

Hey Greg - thanks for updating with the solution and a link, should be a big help for others :slight_smile: [import]uid: 52491 topic_id: 28508 reply_id: 115026[/import]