This content has been marked as final. Show 5 replies
"Zal" <email@example.com> wrote in message
> Hi everyone,
> I want to build a modular RIA in which I have several Flex modules.
> I want to set via a config.xml file which modules will be used for a
> particular "installation" of my app.
> I just forgot that eval() have been removed from AS3... An old reflex.
> How can I instantiate (preferably with strong typing) something I'm only
> of in String format? (like "com.example.myProject.modules.calendar")
> this would allow me to eventually create custom modules without the need
> recompile my main application...
A ModuleLoader has a url property that takes a string that points to the
getDefinitionByName() in flash.util package.
Sounds like modules is the way to go for you.
Also, bracket notation is the direct replacement for eval(), with the added benefit that it works on the right side of an assignment.
var myComponentInstance:MyComponent = this["myComponentId"];
Sorry about the multiple posts, but...
One major drawback to using getDefinitionByName is that the class must be linked into the swf at compile time, if only by a dummy variable. So you have to know and plan for all classes if you use that.
Modules do not have this problem.