Closed T1mL3arn closed 5 months ago
Retrieval of assets on html5 are inherently asynchronous only regardless of the overlaying technology such as openfl or flixel.
The one exception to this is embedding asset data directly into javascript via text-encoding such as base64.
From the title it sounds like you want to do the following:
getText()
and getSound()
to synchronously retrieve the data from cache.I have good news and bad news on that front. The good news is that most of the functions already work that way. Sounds, images, and fonts are all cached, and the cache supersedes the "exists but only asynchronously" error. The bad news is that text is not cached on any target, and this was a deliberate decision way back when, so probably won't be changed.
In any case, Dimensionscape is right: there's no way around loading asynchronously at least once.
Just a note: getting a resource from the cache is still asynchronous even though it is much faster due being local.
I went ahead and closed this issue. If you're having a specific problem with Flixel, be sure to draft an issue there.
Trying to make a minimal repro I found the issue is on Flixel side.
On html I get this
Flixel always(probably) uses sync methods to retrieve assets (e.g.
getText()
,getSound()
), making it impossible to use async assets on html5.