Hey guys! So recently I've run into the need to display from an URL.
I have this so far, yet I get the same error.
"
|D|image.jpg: Error while reading image file."
Here is the code, I would appreciate any help. Thanks in advance!
local loader = UrlLoader.new("https://picsum.photos/200/300/?random")
local function onComplete(event)
local out = io.open("|D|image.png", "wb")
out:write(event.data)
out:close()
local b = Bitmap.new(Texture.new("|D|image.png"))
stage:addChild(b)
end
local function onError()
print("error")
end
local function onProgress(event)
print("progress: " .. event.bytesLoaded .. " of " .. event.bytesTotal)
end
loader:addEventListener(Event.COMPLETE, onComplete)
loader:addEventListener(Event.ERROR, onError)
loader:addEventListener(Event.PROGRESS, onProgress)Also, I tried jpeg as well. I don't think the type is the problem here.
Comments
https://deluxepixel.com
"|T|image.jpeg: Error while reading image file."
Fragmenter - animated loop machine and IKONOMIKON - the memory game
@misterhup - do the same in the player - then look at the file downloaded into T (should be in Userdata/temp/gideros/project name/ or similar) - make sure it's there and is the type of file you are expecting.
https://deluxepixel.com
Likes: hgy29
https://deluxepixel.com
Likes: SinisterSoft, antix
https://deluxepixel.com