Filed under: Uncategorized | Tags: actionScript, development, flash, tips
RSLs are great. What an ideal way to abstract and modularize functionality. And they are not too shabby for loading assets and fonts too. Now AS3 has provided some pretty nifty functions via the ApplicationDomain class in order to retreive a class defined in an external SWF, but you have to know the class name in order to get it. If you use RSLs to, well, have lots of classes loaded at run-time, this can become problematic at best.
In order to work around this you used to have to load a manifest file that basically listed all the classes to be located in an external SWF. Well I didn’t like that solution too much. After doing some poking around on Google, I found something akin to ApplicationDomain.getDefinitions():Array
An AS3 Developer by the name of Denis Kolyako has provided a great solution to this problem. Unfortunately his blog is in Russian but you get the idea:
Until a native solution is provided by the AS3 API, this is the next best thing. Thanks Denis! Spread the word!
2 Comments so far
Leave a comment
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Great! Was looking for this hack for a long time. Its indeed the next best thing!
Comment by Guillaume Malartre Wednesday, February 25, 2009 @ 10:48 pmWell, I think I didn’t get it right – perhaps you can help: Is there a way to user reflection in flex WITHOUT formerly giving all the possible classes inside the code?
E.g.:
public class DefinitionListDemo extends Sprite {
SomeClass;
ExampleClass;
public functi…
–> this can be used, to find the above named (SomeClass, ExampleClass) classes but no other custom classes?!?
I am looking for a way to avoid this former declaration and be still able to create an instance of my custom classes…
Help is really appreciated!
Hope you are having a nice weekend,
Comment by anne Friday, August 14, 2009 @ 3:04 pmAnne