path problem for an image

hello, i want to display  an image who is in the item folder

local path = system.pathForFile(system.DocumentsDirectory) 

–path = C:\Users\bryan\Documents\Corona Projects\

path = path…"/content/items/"

local wall = display.newImage(“wall.png”, path) – it doesn’t works

can someone help me?

i tried this too 

local path = system.pathForFile(system.DocumentsDirectory) 

 

–path = C:\Users\bryan\Documents\Corona Projects\

 

path = path…"/content/items/wall.png"

 

local wall = display.newImage(path)

see docs:  http://docs.coronalabs.com/api/library/system/pathForFile.html

essentially you’re not using it quite right, and are passing a “nonsense” value for the filename (system.DocumentsDirectory is a userdata type, definitely NOT a filename!)

pass it the full relative path plus filename as first parameter, fe “content/items/wall.png”, then specify the base directory as second parameter if necessary - resource directory by default

but is this file really in the documents directory?  if instead it’s in your resource directory (aka the project’s folder) then you probably don’t need pathForFile() at all, just do display.newImage(“content/items/wall.png”)

hth

see docs:  http://docs.coronalabs.com/api/library/system/pathForFile.html

essentially you’re not using it quite right, and are passing a “nonsense” value for the filename (system.DocumentsDirectory is a userdata type, definitely NOT a filename!)

pass it the full relative path plus filename as first parameter, fe “content/items/wall.png”, then specify the base directory as second parameter if necessary - resource directory by default

but is this file really in the documents directory?  if instead it’s in your resource directory (aka the project’s folder) then you probably don’t need pathForFile() at all, just do display.newImage(“content/items/wall.png”)

hth