haven't tried it but maybe try...

import flash.util.getClassByName;

then....
var ClassReference:Class = getClassByName("A");
var instance:Object = new ClassReference(1,2,3);

cheers, Al



On 2 Mar 2006, at 12:25, Vadim Melnik wrote:

Hi All,

It is going to be easy, but I can't figure the way to implement it.
We have certain Class object referencing to some class with
constructor accepting any ... numbers of arguments. Now we are
looking for the way to invoke it dynamically, (something like
Funtion.apply does for plain methods). For example :

...
public class A {
public function A(...args) {}
}
...

var cls:Class = A;
var someArgs:Array = [1, 2, 3];

var a:* = new cls(); // <- how to pass someArgs here ?

// need the same functionality as
// var a:* = new A(1,2,3);

And the same question regarding super class dynamic constructor
invocation:

public class B extends A {
public function B() {
   var myArgs:Array = [4,5,6];
   super(); // <-- how to pass myArgs to parent
   // class constructor, like
   // super(4, 5, 6);
}
}


--
Thanks,
Vadim Melnik.







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to