Temporary introspection of a related SWC using ActionScript 3.0 + Flash / Flex

Wow, my first stack overflow message. "I've come"?

OK, this is weird. I am trying to determine if there could be some programmatic way to introspect the classes inside the associated SWC at runtime.

To give a little more background (maybe there is a completely different way to do this), I am considering a general framework for Font Embedding. Currently, to embed fonts (using the associated SWC, not the [embed] meta tag), you need to embed the font in your SWC using the Flash IDE, and then you need to hardcode the link to the library resource class in your code (possibly created by someone something else, for example, using another IDE - FlashDevelop).

Now, if at runtime you could introspect SWC and iterate over the classes it provides, theoretically you can program / register these fonts programmatically without knowing (at compile time) what these fonts can be.

Therefore, the question arises: does anyone know about access to SWC as an entity at runtime and analyze its vulnerable classes?


On the sidelines, the rationale for this kind of thing is simply striving for a clean separation of responsibilities for design and application logic. It’s easy for the designer to embed the font, author and SWC, as well as edit the corresponding external CSS file. It is much more dangerous to rely on their updating hard links to classes in the code or to rely on the client not to change his mind about using the font after compiling and publishing the task.

+3
2

( LoaderInfo, ), ABC, , .

, . DefineFont2 ( 48), FontID FontName, DefineFontName ( 88), FontID FontName. , , . , .

.swf: http://www.adobe.com/devnet/swf.html

+1

Source: https://habr.com/ru/post/1768151/


All Articles