【问题标题】:Save array images from display.loadRemoteImage从 display.loadRemoteImage 保存数组图像
【发布时间】:2013-04-04 08:00:41
【问题描述】:

display.loadRemoteImage("http://developer.anscamobile.com/demo/hello.png", "GET", networkListener, "helloCopy.png", system.TemporaryDirectory, 50, 50)

您好,我想从我的服务器获取图像数组:

data[i].image = display.loadRemoteImage(URLlimpia, "GET", networkListener, "LOGO" .. i .. ".png" , system.TemporaryDirectory )

但是图像总是出现在模拟器屏幕上,我想保存在任何地方以便稍后在列表中显示。

我该怎么做??

*当图像出现时,如何清除屏幕上的图像??

谢谢

【问题讨论】:

    标签: image load coronasdk


    【解决方案1】:

    试试这个:

    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

    【讨论】:

      【解决方案2】:

      如果您不想立即显示图像,则应使用 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

      【讨论】:

        猜你喜欢
        • 2011-08-02
        • 2021-04-21
        • 2013-10-19
        • 1970-01-01
        • 2010-10-28
        • 1970-01-01
        • 1970-01-01
        • 2012-03-30
        相关资源
        最近更新 更多