explorers’ club


are you looking for ApplicationDomain.getDefinitions():Array? I bet you are
Wednesday, February 25, 2009, 5:36 am
Filed under: Uncategorized | Tags: , , ,

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!


2 Comments so far
Leave a comment

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

Comment by Guillaume Malartre

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

Comment by anne




Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>