Strange error

Hi all,

I’m trying to troubleshoot my How To Play screen in my app. Currently, the code looks like this:

local function howToPlay ()  
 local currentSlide = 0  
 local info1 = display.newImageRect( "info1.png", 380, 570 )  
 info1.x = display.contentWidth\*0.5; info1.y = display.contentHeight\*0.5; info1.alpha = 0  
 local info2 = display.newImageRect( "info2.png", 380, 570 )  
 info2.x = display.contentWidth\*0.5; info2.y = display.contentHeight\*0.5; info2.alpha = 0  
 local info3 = display.newImageRect( "info3.png", 380, 570 )  
 info3.x = display.contentWidth\*0.5; info3.y = display.contentHeight\*0.5; info3.alpha = 0  
 local info4 = display.newImageRect( "info4.png", 380, 570 )  
 info4.x = display.contentWidth\*0.5; info4.y = display.contentHeight\*0.5; info4.alpha = 0  
 local bkg = display.newImageRect( "next.png", 156, 59 )  
 bkg.x = 160; bkg.y = 450; --bkg.alpha = 0  
 transition.to( info1, { time=1000, alpha=1 } )  
 local function nextSlide( event )  
 if currentSlide == 0 then  
 transition.to( info1, { time=1000, alpha=1 } )  
 currentSlide = 1  
 elseif currentSlide == 1 then  
 transition.to( info1, { time=1000, alpha=0 } )  
 transition.to( info2, { time=1000, alpha=1 } )  
 currentSlide = 2  
 elseif currentSlide == 2 then  
 transition.to( info2, { time=1000, alpha=0 } )  
 transition.to( info3, { time=1000, alpha=1 } )  
 currentSlide = 3  
 elseif currentSlide == 3 then  
 transition.to( info3, { time=1000, alpha=0 } )  
 transition.to( info4, { time=1000, alpha=1 } )  
 currentSlide = 4  
 elseif currentSlide == 4 then  
 transition.to( info4, { time=1000, alpha=0 } )  
 bkg:removeSelf()  
 currentSlide = 0  
 end  
 end  
 bkg:addEventListener( "touch", nextSlide )  
  
end  

The program works fine on the simulator. However, when I test it on my device, the program does not show. The console tells me:

WARNING: asset file info1.png does not exist
Lua runtime Error: lua_pcall failed with status: 2, error message is: ?:0: attempt to index a nil value

I’m not sure what is causing this problem. I had a similar error elsewhere in the program, but the cause was a capitalized file name. As far as I can tell, the file name is the same as the one in the program. Can anyone help me with this? [import]uid: 151029 topic_id: 27687 reply_id: 327687[/import]

Happened to me once. The emulator isn’t case sensitive in file names, but the device is…
Make sure your files are actually “*.png” and not “*.PNG” or something like that.

Cheers [import]uid: 67594 topic_id: 27687 reply_id: 112294[/import]

Exactly as ron said above. Check your filenames against the names you have specified in your code. They need to match exactly [import]uid: 84637 topic_id: 27687 reply_id: 112340[/import]

Thanks, I modified the file name and everything is working now [import]uid: 151029 topic_id: 27687 reply_id: 112387[/import]