Jim:

getDefinitionByName("flash.display::Sprite");


Should read:
getDefinitionByName("flash.display.Sprite");

I think.


On 6/18/07, jtgxbass <[EMAIL PROTECTED]> wrote:

In AS3 is done like this...

import flash.utils.getDefinitionByName;
var ObClass:Class = getDefinitionByName( "fully.qualified.class.name " )
as Class;
var instance = new ObClass();



On 6/18/07, elibol < [EMAIL PROTECTED]> wrote:
>
> Not sure since eval() is gone.
>
> Try keeping a reference for each class in some object and use it like a
> hash
> map.
>
> import Circle;
> import Square;
> import Triangle;
>
> var classes:Object {
> "Circle":Circle
> , "Square":Square
> , "Triangle":Triangle
> };
>
> var list:Array = new Array("Circle","Square","Triangle");
>
> for(var i=0;i<list.length;i++){
>        var cls:Class = classes[list[i]];
>        var instance:* = new cls();
> }
>
> It would be nice to see a less involved solution though...
>
> On 6/18/07, Patrick Matte|BLITZ < [EMAIL PROTECTED]> wrote:
> >
> > Hey fellows, in AS3 how can I create class instances from a list of
> > classes names. Take for example something like this:
> >
> > import Circle;
> > import Square;
> > import Triangle;
> >
> > var list:Array = new Array("Circle","Square","Triangle");
> >
> > for(var i=0;i<list.length ;i++){
> >         var class = new list[i]();
> > }
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to