Is there a way to get all the classes in the current application. Say for example you create a blank Application and want to see all the classes that exist, this would list system manager, application, uicomponent, etc.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately, the list of classes in the domain is not made available by the standard Reflection API.
However, the AS3 Commons Bytecode library exists, which is able to read the Bytecode of the current app (or any bytecode for that matter) and parse it, providing access to all the current classes in the domain. (Along with a whole bunch of other cool stuff).
There’s an example showing how to do what you’re after here.
The downside of using this library is that you have to re-load and parse the data at runtime, which has a significant performance cost.
James Ward and Mike Labriola did some work on modifying the SWF Loaders which load the initial bytecode into your flex app, so that the reflection is performed at startup, reducing the need to parse the bytecode twice.
James has blogged about his results here.