Thanks yupswing !
I may rebuild my game without HaxePunk (to reach better performances), and this is definitly going to be of great help.
Keep going on !
Does the preloader allow to load xml files, connect to web server in different steps before start loading the main app resources?
I have to load configuration xmls, call services based on the configuration, load other resources based on service reply etc, and after all this load the main application resources, that can change depending on the configuration and the services reply.
this preloader allows to show some feedback while the app is loading its own content (assets). it works in flash and web targets.
you are talking about another stage you have to build.
nothing stops you from integrate the two stages in one, but the nmepreloader will be always first because as shown in the code you don’t control the preload process, you just witness it and you can listen to the updates to show the user a progress bar
Does the progress bar show the loading process of all the resource assets contained in the folders specified in the project.xml? If so, I think I should do all the steps I listed AFTER that, right?
I see problem, regarding the placement of “logo” on html5 target.
First of all, splash.width and height is not accessible for some reasons. Also, x,y,scaleX, and scaley generate wrong placement. However, all these work fine on Flash.
If the file’s being loaded, it’s asynchronous (but handled internally within bitmapData), so might need to wait for it to load completely before checking the size
It looks like for me even EnterFrame cannot help to detect the width & height of embedded bitmaps (html5). When i tracing the size on each frame, i’m getting “Infinity” in values or “NaN”. Is there is any solution to this problem?
In that case, you want a regular loader, not a preloader. Do the work on a separate thread (also available for Neko), periodically dispatching progress messages. When the main thread receives a progress message, update the loading bar.
Actually, depending on what’s causing the lag, you might not have to go to that much trouble. If you disable preload="true" and use Assets.loadLibrary(), it will do the first part of the work asynchronously. If that turns out to be what was causing the freezes, then you’re done!