monkey mojo needs a standard preloader

Monkey Forums/Monkey Programming/monkey mojo needs a standard preloader

AdamRedwoods(Posted 2012) [#1]
Sure you could make your own, but it should be standard in mojo. Plus, web targets would need an external lib to make this possible, since their files load asynchronously anyways.

OnLoading() seems like a good candidate for this thing, but is it robust enough? I hear it doesn't work as intended in Flash (I have not tested yet).

my thought was to use a function to take an array of filenames, the function would return false if it's still loading, true when it's done. this would allow for while/wends or state machines, depending on how people code.

one function for all file types (images, base64, music) or separate (?).

pseudo example
OnRender()

   Local filelist$ = ["player_atlas.png","enemey1_atlas.png","ui.png"]

   While Not( PreLoadImages(filelist))
   
      ''Do your rendering, waiting music, percent loaded here

   Wend
   
End

''elsewhere....
Local player_image:= LoadImage("player_atlas.png")
''LoadImage() checks for preloaded, mojo could flush the original load memory

''or alternatively...
Local player_image:= GetImage("player_atlas.png")


Is there anything I didn't think of?


therevills(Posted 2012) [#2]
The issue with Flash is that the whole application needs to be downloaded before it can be run, the preloader needs to be added on the side so it loads that first...


AdamRedwoods(Posted 2012) [#3]
The issue with Flash is that the whole application needs to be downloaded before it can be run, the preloader needs to be added on the side so it loads that first...

ah, that's right.
Could the images be placed in a separate swf? It seems like a good candidate with flex compiler using SWFLoader.