Hey folks, I’m downloading a 2048 x 2048 JPG file from the web:
local function LoadRemoteImage( event )
if ( event.isError ) then
print ( "Network error - download failed" )
else
backgroundImage = display.newImage( "helloCopy.png", system.TemporaryDirectory)
backgroundImage.alpha = 0
gameBoard:insert(backgroundImage)
transition.to( backgroundImage, { alpha = 1.0 } )
end
print ( "RESPONSE: " .. event.response )
loadSuccessful = true
network.request( "http://www.iswdev.com/stuff/getDungeonInfo.php?id="..projectID, "GET", LoadRemoteText )
end
network.download( "http://iswdev.com/stuff/battlemaps/maps/"..projectID..".jpg", "GET", LoadRemoteImage, "helloCopy.png", system.TemporaryDirectory )
It loads fine at full resolution on my Windows environment and runs just fine in the iPad simulator.
But I moved the files over to my Mac to deploy to my iPad and something screwy happened…the image was loaded at half resolution!
OK, I remember I had to set a flag on the image load to force it to load at full resolution:
http://developer.anscamobile.com/content/display-objects
But, how do I do that when downloading the image from the web in the above code? So far to get around the issue, I have to manually scale the object and then move it:
[code]
local function LoadRemoteImage( event )
if ( event.isError ) then
print ( “Network error - download failed” )
else
backgroundImage = display.newImage( “helloCopy.png”, system.TemporaryDirectory)
backgroundImage.xScale = 2
backgroundImage.yScale = 2
backgroundImage.x = backgroundImage.x + 512
backgroundImage.y = backgroundImage.y + 512
backgroundImage.alpha = 0
gameBoard:insert(backgroundImage)
transition.to( backgroundImage, { alpha = 1.0 } )
end
print ( "RESPONSE: " … event.response )
loadSuccessful = true
network.request( “http://www.iswdev.com/stuff/getDungeonInfo.php?id=”…projectID, “GET”, LoadRemoteText )
end
[/code] [import]uid: 11636 topic_id: 16146 reply_id: 316146[/import]