how can I set a sprite frame based on "name" (and not index) - i.e. SpriteObject:setFrame( frameIndex )

How can I do a SpriteObject:setFrame but then pass the “name” of the sprite frame I want not the index?

Background
* Have a spritesheet and lua file generated by TexturePacker
* in the lua file there is the use of “name”, however when I set the frame I have to pass the index
* the actual sprites within the texture file are out of order too, so it’s not as if the 2nd sprite image I added in TexturePacker to be included is actually 2nd in the lua file

currSprite:setFrame(spriteIndex)  
  
local SpriteSheet = {}  
SpriteSheet.getSpriteSheetData = function ()  
 return {  
 frames = {  
 {  
 name = "1.png",  
 spriteColorRect = { x = 20, y = 9, width = 12, height = 26 },  
 textureRect = { x = 114, y = 64, width = 12, height = 26 },  
 spriteSourceSize = { width = 50, height = 50 },  
 spriteTrimmed = true,  
 textureRotated = false  
 },  
 {  
 name = "10",  
 spriteColorRect = { x = 4, y = 6, width = 36, height = 30 },  
 textureRect = { x = 2, y = 66, width = 36, height = 30 },  
 spriteSourceSize = { width = 50, height = 50 },  
 spriteTrimmed = true,  
 textureRotated = false  
 },  
  

[import]uid: 140210 topic_id: 29024 reply_id: 329024[/import]

You can use the function that is provided in your texturepacker generate .lua file

function SheetInfo:getFrameIndex(name)  
 return self.frameIndex[name];  
end  

You just need to pass the name to this function and it will return the index something like

SpriteObject:setFrame(mysheetInfo:getFrameIndex("theframename"))  

[import]uid: 77943 topic_id: 29024 reply_id: 117148[/import]

oh, I’m using TexturePacker 3 (3.0.0b10) and I don’t see in the data file (*.lua) a “getFrameIndex” method defined anywhere?
[import]uid: 140210 topic_id: 29024 reply_id: 117149[/import]

@greg886: The “getFrameIndex” method should be at the bottom of your texturePacker-generated LUA file, just below the “getSheet” method. 

@greg886: The “getFrameIndex” method should be at the bottom of your texturePacker-generated LUA file, just below the “getSheet” method.