Hehe, die __resolve würde ich aber dafür nicht
verschwenden, aber genial ist es auf alle Fälle...;-)
Hier nochmal mit Arguments und OnlyLastMethod-
Flag.
Kann man es nicht mit irgendeinem ASNative schaffen
an den Text der Funktion ranzukommen?
In Javascript ist das ja das normale toString-Verhalten
einer Funktion.
Wäre halt Klasse wenn man die erwarteten Argumente-
Bezeichner mit ausgeben könnte.
*grübel*
ActionScript:
trace(String(traceMessages = function (pObj, pBlnLastMethodOnly) {
for (var p in pObj) {
if (typeof pObj[p] != 'function') continue;
var tmp = pObj[p];
pObj[p] = function() {
trace('call-of> ' + arguments.callee.__methodName + '(' + arguments.join(', ') + ')');
arguments.callee.__originalMethod.apply(this, arguments);
}
pObj[p].__methodName = p;
pObj[p].__originalMethod = tmp;
if (pBlnLastMethodOnly) return '';
}
return '';
}).substr(0,0));
// Test
Kaefer = function () {}
Kaefer.prototype.init = function (pStrName, pIntAge) {
this.strName = pStrName;
this.intAge = pIntAge;
}
Kaefer.prototype.traceProperties = function () {
trace(this.strName + '(' + this.intAge + ')');
}
objPaule = new Kaefer();
trace(traceMessages(objPaule)); // <--
objPaule.init('Paule', '23');
objPaule.traceProperties();
// Output:
//
// call-of> init(Paule, 23)
// call-of> traceProperties()
// Paule(23)