Blue Infinity
Member
Hi all!
I'm using
What am I missing here?
Create event:
Async HTTP event:
Draw event:
I'm using
http_get_file
to download an image from an url and then create a sprite using sprite_add
in the async event that triggers once file request finishes. The request succeeds with status code "0" (ds_map_find_value(async_load, "status") = 0). However, for some reason, the image that I downloaded does not get drawn. This seems to work on Windows platform.What am I missing here?
Create event:
GML:
newSprite = -4
filePath = "\images\\player"+string(0)+".png"
imgUrl = "https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcT2_ofdtFV7VBXo0ie1nNmcSoCIBeHAf4jz2w&usqp=CAU"
http_set_request_crossorigin("use-credentials")
imageRequest = http_get_file(imgUrl,filePath)
GML:
if ds_map_find_value(async_load, "id") == imageRequest
{
if ds_map_find_value(async_load, "status") >= 0
newSprite = sprite_add(filePath,1,false,false,0,0)
}
GML:
if newSprite > -1
draw_sprite(newSprite,0,200,200)