Trick while creating new AW object instance
Hi, guys
as you know, in the original AW framework, you can only get a new instance of any AW class with the default no-parameter constructor(at least, i think so). if you wanna instance an object which initialized with various value in runtime, you have to do like this
var obj = new Foo.Foo2.Bar;
obj.setSomeProperty(value);
obj.setSomeOtherProperty(value2);
so i checked the JavaScript1.3 document and i think maybe we can do a little tricky thing to Alex's subclass method in Active.System.Object :)
in line 10:
var constructor = function(){this.init()};
now try to change to this:
var constructor = function(){this.init.apply(this, arguments)};
Then in the init method of any subclass of Active.System.Object, you can retrieve the constructor arguments array while you try to new an instance of this (sub)class, within the exactly same syntax to get the arguments while calling a function in JavaScript spec 1.3
it works well on my computer.
my enviorment is: Pentium II 500, Windows XP SP1, IE 6.0.2800.1106.xp SP2.030422-1633
and the same good within MyIE2 0.9.10
Hope it will be useful, if so, Enjoy it :)
as you know, in the original AW framework, you can only get a new instance of any AW class with the default no-parameter constructor(at least, i think so). if you wanna instance an object which initialized with various value in runtime, you have to do like this
var obj = new Foo.Foo2.Bar;
obj.setSomeProperty(value);
obj.setSomeOtherProperty(value2);
so i checked the JavaScript1.3 document and i think maybe we can do a little tricky thing to Alex's subclass method in Active.System.Object :)
in line 10:
var constructor = function(){this.init()};
now try to change to this:
var constructor = function(){this.init.apply(this, arguments)};
Then in the init method of any subclass of Active.System.Object, you can retrieve the constructor arguments array while you try to new an instance of this (sub)class, within the exactly same syntax to get the arguments while calling a function in JavaScript spec 1.3
it works well on my computer.
my enviorment is: Pentium II 500, Windows XP SP1, IE 6.0.2800.1106.xp SP2.030422-1633
and the same good within MyIE2 0.9.10
Hope it will be useful, if so, Enjoy it :)
Copenhagen
May 12,