display.loadRemoteImage(" http://developer.anscamobile.com/demo/hello.png"," GET",networkListener," helloCopy.png",system.TemporaryDirectory,50,50 )
您好,我想通过以下方式从我的服务器获取ARRAY图像:
data [i] .image = display.loadRemoteImage(URLlimpia," GET",networkListener," LOGO" .. i .." .png", system.TemporaryDirectory)
但是图像总是出现在模拟器屏幕上,我想保存在任何地方以便稍后在列表中显示。
我该怎么做?
* 如何在屏幕上显示时清除图像?
感谢
答案 0 :(得分:0)
试试这个:
local function networkListener( event )
if ( event.isError ) then
print ( "Network error - download failed" )
else
event.target.isVisible = false
end
print ( "RESPONSE: " .. event.response )
end
display.loadRemoteImage( "http://www.coronalabs.com/demo/hello.png", "GET", networkListener, "helloCopy.png", system.TemporaryDirectory, 50, 50 )
更多信息:
http://docs.coronalabs.com/api/library/display/loadRemoteImage.html
答案 1 :(得分:0)
如果您不想立即显示图像,则应使用 network.download()而不是display.loadRemoteImage()
在你的例子中:
local params = {}
params.progress = true
for i=1,n do
network.download(
URLlimpia,
"GET",
networkListener,
params,
LOGO" .. i .. ".png",
system.TemporaryDirectory
)
end
http://docs.coronalabs.com/api/library/network/download.html