Preloader problems with TextField on Flash target

I am learning to implement a Preloader for all the main assets (swf). I have extracted information from the CustomPreloader example:

But when you add a TextField with a custom embedded font to show the preload percentage, this text is shown to be corrupt, split in half (vertically).

Besides, if I add a TextField to the Main class with that same custom font and the same exact code that I have in the Preloader Class, it is displayed correctly. The visual error only appears if I instantiate and add the TextField within the Preloader Class.

This only happens in Flash target. It does not happen in html5 … Does anyone know if it is some kind of known bug ?. And it only happens if the font is embedded (necessary for a custom font, I think).

And another question: Is there the possibility of initially loading a swf with only preload elements (more elaborate than a simple line and a background image), and later preload a swf with all the contents?

Thank you!

We force all the embedded assets (including fonts) into “Frame 2” of the SWF. We could consider including embedded fonts on the first frame, but I think that would potentially hurt the quality of preloading, especially if there are a lot of fonts or they are large.

I believe it might be possible to use the @:font meta-data, to use the Haxe Flash font embedding system, and use that in the preloader, or it would be necessary, like you said, to use more than one SWF.

You can use one SWF to preload another, just use openfl.display.Loader, but I recommend not including the loaded SWF in the same ApplicationDomain, since some of the classes may conflict, such as ApplicationMain.