Ian and David - interesting. So what is the difference between getDefinition
and getDefinitionByName?
What I ended up using was this, which works well:
var ClassReference:Class =
getDefinitionByName("people."+_associates[_associateCount]) as Class;
var instance = new ClassReference();
If I need it to be cast as the class it subclasses, like a MovieClip, so it can
be added to the stage, I do:
addChild(MovieClip(instance));
is there any particular reason to use getDefinition instead? At first glance,
seems to accomplish the same thing.
Jason Merrill
Bank of America Instructional Technology & Media · GCIB & Staff Support
L&LD
Interested in Flash Platform technologies? Join the Bank of America Flash
Platform Developer Community
Interested in innovative ideas in Learning? Check out the Innovative Learning
Blog and subscribe.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Hershberger
Sent: Thursday, November 20, 2008 5:22 PM
To: Flash Coders List
Subject: Re: [Flashcoders] get class by definition - or something like that
You want ApplicationDomain.getDefinition(className: String)
and also ApplicationDomain.hasDefinition(className: String) is handy.
Dave
On Thu, Nov 20, 2008 at 1:52 PM, Merrill, Jason <
[EMAIL PROTECTED]> wrote:
> Refersh my memory. What was the name of that AS3 class method to get a
> class definition from a string? Something like
> getObjectByDefinition("MyClass") or something like that, but that's not it.
> Our proxy server is down and I can't Google it, and the help docs are no
> help.
>
> Basically, I'm tring to remember the AS3 method to dynamically instantiate
> a class from a string definition - i.e.
>
> var ClassDefinition:Class = getClassByDefinition("Apple");
> var newClassInstance:* = new ClassDefinition();
>
> Something like that, I've done it before, I just can't find the syntax or
> remember the method.
>
> Jason Merrill
> Bank of America Instructional Technology & Media · GCIB & Staff
> Support L&LD
>
> Interested in Flash Platform technologies? Join the Bank of America Flash
> Platform Developer Community
> Interested in innovative ideas in Learning? Check out the Innovative
> Learning Blog and subscribe.
>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders