Hrm... how about: class com.packageName.MyClass { public static function create():MyClass { var inst:MyClass = new MyClass(); return inst; }
public function toString():String { return "[MyClass]"; } } import com.packageName.MyClass; trace(MyClass.create()); ----- Original Message ----- From: "Rich Rodecker" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com> Sent: Thursday, December 29, 2005 11:35 PM Subject: [Flashcoders] Re: calling a static method on dynamically namedclass? hmm i tried storing a reference to the class in a variable, like var myClass = com.packageName.MyClass > > myClass.create() and i got this message: Static members can only be accessed directly through classes there's gotta be a way to pull this off. On 12/29/05, Rich Rodecker <[EMAIL PROTECTED]> wrote: > > I know you can instantiate objects by doing: > > var myObj = new _global[className](); > var className = "TestClass"; > > but is it possible to call a static method of a class in a similar way? > Im trying these two ways, and its not working for me: > > _global[iconName].create() > _global[iconName]().create() > > > if I try and do a trace on the class like trace( _global[iconName]) i get > undefined. The icon classes are subclasses of movieclip so that might > make > a difference. > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders