HTML5 http resource path not working

Monkey Forums/Monkey Bug Reports/HTML5 http resource path not working

DruggedBunny(Posted 2012) [#1]
Testing this under HTML5 on latest Windows Chrome/Firefox under Monkey 67b, the image is always instantly Null, yet as far as I can see it's compliant with the Resource Paths documentation:

Import mojo

Class Game Extends App

	Field mx:Float, my:Float
	
	Field image:Image
	
	Method OnCreate ()
	
		image = LoadImage ("http://www.hi-toro.com/boing.png")
		
		If image = Null Then Print "No loady image"
		
		SetUpdateRate 60
		
	End
	
	Method OnUpdate ()
	
		mx = MouseX ()
		my = MouseY ()
		
	End
	
	Method OnRender ()
	
		Cls 64, 96, 128
		DrawImage image, mx, my

	End
	
End

Function Main ()
	New Game
End


I was hoping to answer this query, at least for the currently supported platforms. I didn't actually realise we had remote resource support (cool!) and initially tried to do it via HTTP GET, but of course I'd have had to save the file and then call LoadImage, which would be a bit crap as well as more prone to failure.

EDIT: Just tried uploading to the same server (ie. hi-toro.com) in case it was a domain thing, but same result.


marksibly(Posted 2012) [#2]
Sorry, docs are wrong - you can't (yet) LoadImage from a 'non-data' source in html5.


David Casual Box(Posted 2013) [#3]
That's a bad news, I just filled a bug report for that :(

The fact is, I'm OK to code something as a workaround but there is no way:
- cannot load from a url
- cannot add an image to the data folder after the game was compiled

We are building a big html5 casual game portal with monkey and facebook connect and this missing feature is a big big blocker.


AdamRedwoods(Posted 2013) [#4]
does "Class AsyncImageLoader" work with url sources? it wouldn't be hard to implement.


David Casual Box(Posted 2013) [#5]
Try this:
http://www.monkeycoder.co.nz/Community/posts.php?topic=5271