macromedia flash actionscript scripting, php, remoting, webservices, c#, javascript
Ok, first let us look the example:
MyClass = function () {}
MyClass.prototype.__resolve = function (pStrMethodName) {
return function () {
trace('ERROR: "' + pStrMethodName + '" does not exist!');
trace('\tArguments:');
for (var i in arguments) {
trace('\t\t' + arguments[i] + '(' + typeof(arguments[i]) + ')');
}
}
}
obj = new MyClass();
obj.strangeMethodName('param1', 'param2');
// output:
// ERROR: "strangeMethodName" does not exist!
// Arguments:
// param2(string)
// param1(string)
So the first point is that you can use it
to determine that you have called an non
existing method.
The second point is that you can proposed
write an type into you method-call to observe
the correctness of your arguments. I think
thats an good an easy way for getting a quick
watch.
Oh, man i feel that my english is totally wrong,
hope you understand me, anyhow...;-)
Posted by hOk at May 5, 2003 11:09 PM
Comments (5)
I think when Macromedia engineers created "_resolve" method, the purpose was exactly debugging and trapping calls of non-existent methods calls.
I start to use "_resolve" method for proxying method calls to my View, Model and Controller components
At the moment, I began with "switch" statement to iterate through correct methods names
//---------------------------
Button.prototype.__resolve = function (pStrMethodName) {
return function () {
var methodFound = false;
switch (pStrMethodName)
{
case "swapClip":
{
this.View.swapClip(arguments[0]);
methodFound = true; break;
}
}
//---------------------------
Do not worry about your English, it is good enough, your code speaks for itslef.
Your English is also definately better than mine German with a help of BabelFish
=)
Posted by JabbyPanda at May 7, 2003 11:48 AM
I understand the method "_resolve", yet I've not come to terms with it.
I have not had a reason to use it. Maybe in due time...
Posted by dv8 at May 7, 2003 06:26 PM
Great idea!!! =) One question: do you know if there is a __resolve equivalent in other languages, such as JavaScript?
Posted by Jonas Galvez at May 26, 2003 08:19 PM
No, in JavaScript is nothing like that,
and php is also nothing like that.
Who can tell us if there is an equivalent
in vb, c++ or java?
regards, Holger
Posted by hOk at May 27, 2003 05:00 PM
Java is a programming language not a scripting language. However using Reflection it will throw MethodNotFound during runtime. Java will not compile if you call a method that doesn't exist (doesn't have to be implement , mind you) at compile time.
Posted by onno at July 15, 2003 07:16 PM
|
You can use <code>code that should be highlightned</code> to highlight code! Optionally you can use the attribut language="php|perl|java" within the code tag, otherwise actionscript-highlightning will be used. |
