Retrieve display object from networkListener

Hi all, I’ve been struggling with this problem… I can’t seem to get the image out of the networkListener function after I download the image. The variable img works inside the networkListener function but outside, it is nil.

here’s the code:
[lua]local img

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

end

display.loadRemoteImage( “http://developer.anscamobile.com/demo/hello.png”, “GET”, networkListener, “helloCopy.png”, system.TemporaryDirectory, 60, 280 )

print(img) --returns nil[/lua]

Basically, I want to be able to use the variable img later on in the code

Thanks,
David [import]uid: 74346 topic_id: 20636 reply_id: 320636[/import]