Tuesday, 30 July 2013

How to load a remote image to your application screen using Corona SDK

 Is it possible to load a picture that is located on a server, and display it on your application screen using corona SDK..? Yes it is...
You can use the following code for achieving this:

local function networkListener( event )
        if ( event.isError ) then
                print ( "Network error - download failed" )
        else
                event.target.alpha = 0
                transition.to( event.target, { alpha = 1.0 } )
        end

        print ( "RESPONSE: " .. event.response )
end

display.loadRemoteImage( "http://goo.gl/FsRnwu", "GET", networkListener, "banner.png", system.TemporaryDirectory, 25, 50 )

No comments:

Post a Comment