local function showPhoto( event ) if ( event.isError ) then print( "Network error - download failed: ", event.response ) elseif ( event.phase == "ended" ) then profilePhoto = display.newImage( event.response.filename, event.response.baseDirectory) profilePhoto.width, profilePhoto.height = common.fullw, 180 profilePhoto.alpha = 0 profilePhoto.anchorX = 0 profilePhoto.anchorY = 0 profilePhoto.x = 0 profilePhoto.y = 0 transition.to( profilePhoto, { time=500, delay=2000, alpha=1.0 } ) scrollView:insert( profilePhoto ) end end network.download( "http://127.0.0.1/image/" .. settingJson.image, "GET", showPhoto, "profile.png", system.TemporaryDirectory)
How can I manage a profilePhoto variable outside of a function? How can I get the value of a variable from a specified function?