Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua 从system.Documents目录加载映像时出错_Lua_Coronasdk_Corona Storyboard_Corona Director - Fatal编程技术网

Lua 从system.Documents目录加载映像时出错

Lua 从system.Documents目录加载映像时出错,lua,coronasdk,corona-storyboard,corona-director,Lua,Coronasdk,Corona Storyboard,Corona Director,我试图从system.Documents目录加载映像,但收到此错误消息 WARNING: Failed to find image(C:\Users\beri\AppData\Roaming\Corona Labs\Corona S imulator\Sandbox\jet shooter - pro-B1C630B0B5247780928E75EA15C69ABF\Documents\cu stomJet.png) 我正在使用此代码创建图像并再次显示它,但我收到错误消息说图像不存在 -- C

我试图从system.Documents目录加载映像,但收到此错误消息

WARNING: Failed to find image(C:\Users\beri\AppData\Roaming\Corona Labs\Corona S
imulator\Sandbox\jet shooter - pro-B1C630B0B5247780928E75EA15C69ABF\Documents\cu
stomJet.png)
我正在使用此代码创建图像并再次显示它,但我收到错误消息说图像不存在

-- Creating the image 
local screenBounds =
 {
     xMin = 0,
     xMax = 800,
     yMin = 116.5,
     yMax = 360,
 }
 local customJet = display.captureBounds( screenBounds )
 local baseDir = system.DocumentsDirectory;
 display.save( customJet, "customJet.png", baseDir)

-- Loading the image 
local path = system.pathForFile( "customJet.png", system.DocumentsDirectory )
local jetOne = display.newImage(path)

有什么帮助吗

+1但您可能应该解释原因:newImage希望文件名与baseDir相对,baseDir的默认值为system.ResourceDir。在您的情况下,png位于documents文件夹中,因此您必须覆盖您在回答中显示的内容。谢谢你的发帖。
-- Creating the image 
local screenBounds =
 {
     xMin = 0,
     xMax = 800,
     yMin = 116.5,
     yMax = 360,
 }
 local customJet = display.captureBounds( screenBounds )
 local baseDir = system.DocumentsDirectory;
 display.save( customJet, "customJet.png", baseDir)

-- Loading the image 
local jetOne = display.newImage( "customJet.png", system.DocumentsDirectory )