It only works when targeting flash though.
If i choose Neko the app will crash after URLLoader.load().
And when targeting Windows it shows compilation error “Dynamic should be openfl._v2.text.Font” for the line where registerFont is called.
var fontVerdana:Class<Dynamic> = cast (event.target.applicationDomain.getDefinition("Verdana"), Class<Dynamic>);
However, the good news is that you should be able to use web fonts in HTML5, which won’t require the whole loading process at all – just set your font name and move forward. In Windows, you should be able to load TTF fonts from disk. Can you bundle all the fonts you need with your project, or do you need to download it separately?
But i have a question. When targeting Windows, is font loading the only limitation when accessing assets from externally loaded SWF?
Or should external SWF loading be avoided at all for all platforms except flash? If so, how do i perform dynamic assets loading from web - do i simply load files directly one by one?
Sure, on a native level, you load images, fonts, meta-data (etc) using separate files, or the format of your choosing (perhaps use an archive, and decompress, etc).
There is the “swf” library, which can support runtime processing of a SWF asset, but it will not support any code (only assets) and it might not be perfect, but you could give this a try, and contribute if you find any issues (and if this is the path you like most).
var swf = new SWF (Assets.getBytes ("myFile.swf"));
var clip = swf.createMovieClip ("ExportedSymbolName");
It should have the ability to get BitmapData as well
EDIT: However, keep in mind this is only going to work well on native. Runtime handling of SWF assets is not supported by the SWF library for HTML5, and would be very inefficient, I feel.