How can I reduce my loading time?


I’m making an OpenFl game using the native target & it’s loading slowly on mobile devices. How can I reduce the loading time for the user?

The issue occurs when I’m either 1) loading assets from my SWF library or 2) creating variables in my code (eg. the variables associated with UI elements).

Currently, I do all the loading/initialization shortly after the player launches my game. For the first 7 seconds, they just see a static loading image. Not ideal!

I’ve tried to decrease the length of time but with only limited success. I’ve found that if I do too much loading/initialization at once, the rest of the game freezes until it’s complete.

Here’s what I’ve tried:
1. Multi-threading: It sometimes helped but I couldn’t get it to work consistently.
(Also, I’ve read people saying not to use it with DisplayList items.)
It’s quite possible I’m not using it correctly.

2.Assets.loadBitmapData helped to load a few assets asychronously & save a small amount of time. But most of my assets are MovieClips.

3.Breaking up my loading & initialization code into small pieces that are executed on different frames. This saved me a few seconds. My impression is this is what [some people do][1]. I suppose I could break up my loading code into 20 or so small pieces run on different frames, but I’m hoping there’s a more elegant solution.

I hope to decrease the loading delay by a few more seconds. My game is only medium-sized & the SWF file I load is 20 MB.

It’d be ideal if the game could be doing something in the foreground while assets are simultaneously being loaded. My impression is that OpenFl only has limited ability to do this. Or am I wrong?



P.S. The specific devices it’s loading slowly on are BlackBerry devices - Z10, Q10 and Z30.

7 seconds is not long. Some games take up to 40 seconds on my old xperia.

Maybe you don’t have to load all of the assets at the start? You could preload only main menu, then rest of the game when user starts first level.

If you’re making your assets in Flash, there are a number of optimizations you can try.

Thanks @hcwdikk and @player_03!

@hcwdikk : I realize 7 seconds isn’t tooo bad. But I want to make the user experience as good as possible. I’ll experiment with loading less at the start and more during the game. I’ve tried this but so far my experience has been that the rest of the game freezes while the loading/initialization happens.

@player_03: Thanks for the tip! I’ve created all my assets in Flash Professional, so the site you suggest looks super helpful.

Back to coding!


You can try splitting your 20MB SWF into smaller swfs and loading them as needed.

@dimumurray Thanks! Great idea. I’ll look into it more. I’ve played around a bit with it already & found that it reduces the initial loading time but generates pauses/stutters when I try loading the second SWF. But I’m sure I could implement it in a cleverer way.

I was pleasantly surprised that OpenFl allowed me to load multiple SWF libraries.

Thanks again!


Does it work with SWFLite? Tends to run much faster

Thanks @singmajesty! Haven’t tried it but will check it out for sure. Definitely sounds like it could help.