explorers' club

explorations in dev, science, sci-fi, games, and other fun stuff!

are you looking for ApplicationDomain.getDefinitions():Array? I bet you are

2 Comments

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:

  • orignal discussion – link
  • blog posting (in Russian) – link
  • source – link

Until a native solution is provided by the AS3 API, this is the next best thing.  Thanks Denis!  Spread the word!

Advertisements

2 thoughts on “are you looking for ApplicationDomain.getDefinitions():Array? I bet you are

  1. Great! Was looking for this hack for a long time. Its indeed the next best thing!

  2. Well, 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,
    Anne

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s