event.isError not firing in my display.loadRemoteImage()

Not sure if bug or me.

My code:

1
2
3
4
5
6
7
8
9
10
11
12
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
 local imagefile = "http://shop.rareparts.com/img/img300/" .. mastnum .. ".jpg"
 print("imagefile=" .. imagefile)
display.loadRemoteImage( imagefile, "GET", networkListener, mastnum .. ".jpg", system.TemporaryDirectory, 10, 170 )

Devised a work-around but hopefully there is a better way.

I display a "Checking for Image" text message in the area that would be covered by image.
With a timer delay I change the message to "No image available"

Not as nice as the real thing would be as sometimes timer runs out before image loads but that's minor as the image covers it all up.

Not best but better than leaving the user hang expecting an image.

views:1448 update:2011/10/1 9:04:19
corona forums © 2003-2011