从system.DocumentsDirectory加载图像时Corona SDK收到错误

时间:2014-01-31 00:57:11

标签: lua corona corona-storyboard corona-director

我正在尝试从system.DocumentsDirectory加载图像,但是我收到此错误消息。

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 个答案:

答案 0 :(得分:1)

-- 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 )
相关问题