Got another fun bug that I can only reproduce in browser using pepperflash. This time it's related to the AssetManager.
I'm using the boilerplate AssetManager progress bar from the tutorials:
s_assets.loadQueue( function onProgress( a_ratio : Number ) : void
{
progressBar.ratio = a_ratio;
// show 100% for a while with a short delay
if( a_ratio >= 1 || isNaN( a_ratio ) )
{
Starling.juggler.delayCall( function() : void
{
progressBar.removeFromParent( true );
onAssetLoadQueueComplete();
}, 0.15 );
}
} );
Suddenly my complete handler was getting called 50+ times. So I added some debug statements to get a look at what's going on and here a portion of what ratio is during each call to onProgress.
[-] 0.19830919309932665
[-] 0.19994417235938586
[-] 0.19994417235938586
[-] 0.20106382978723408
[-] Infinity
[-] Infinity
[-] Infinity
[-] Infinity
[-] Infinity
[-] 0.21063829787234045
[-] Infinity
[-] 0.22021276595744685
[-] 0.22605732948600063
[-] 0.22605732948600063
[-] 0.22787234042553195
[-] 0.22978723404255322
[-] Infinity
[-] 0.23936170212765961
[-] 0.24702127659574474
[-] 0.24893617021276598
[-] Infinity
[-] Infinity
[-] Infinity
[-] Infinity
[-] Infinity
[-] 0.25851063829787235
It carries on like that. I guess since Infinity >= 1, each time it happens it causes the onComplete process to start.
I'll look into why ratio is coming out as Infinity in a bit, have to run to a dentist appt.