hello All,
I created a customLoad script that I want to call right after the preload. The idea is to load some extra assets from the web while im still in the loading screen.
I start my custom load when I receive the ‘preload:end’ message in the loading screen, I then call :
app.fire(‘customload:start’); I then load all my extra stuff.
I will hide my loading screen when I receive :
app.on(‘customload:end’, function () {
hideSplash();
});
The problem I have right now is that sometime my script is not yet loaded or finished loading. So I added this :
app.on(‘preload:end’, function () {
app.off(‘preload:progress’);
setTimeout(function() {
//let the time for scripts to load properly
app.fire('customload:start');
}, 100);
});
But on some situation, I would need to put 1000ms or more for this to work.
Is there a sure way to know that my script is loaded and ready to use?
I tried
app.assets.on(“load”, function (asset) {
console.log("asset loaded: " + asset.name);
But seems like script is not yet available at that moment? (script will never receive app.fire(‘customload:start’))
Thanks for your support.
Mykel