On 11/18/05, Martin Wood <[EMAIL PROTECTED]> wrote:
> Will you only be creating one type of object? or multiple types?
>
> If its just one, then myFactory.getDrag() can create and return the
> object..but im guessing thats not the case or you wouldnt be asking :)
>
> so, you could return a string of the full class name (including its
> package) and assuming that any class you want to create implements the
> same interface so you can rely on some type information further down the
> line, you could try :
>
> String className = myFactory.getDrag();
> IDrag drag = new _global[className]();
This wouldn't work if it's in a package. You'd need to do:
var className:String = myFactory.getDrag();
var drag = new eval("_global."+className)();
[] only works for things directly attached to the object. Your example
would work if his class was "MyClass", but it wouldn't work if it was
"org.com.MyClass"
-David R
>
>
> [EMAIL PROTECTED] wrote:
> > I have a class named Drag with a static function create.
> >
> > A drag is created as : Drag.create(...)
> >
> > Now I would like to use a Factory to return a drag, but the problem is
> > that the Factory has to return the class Drag instead of an instance of
> > Drag...
> >
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders