I wouldn't recommend it, but you can do it using a dynamic class:
package {
public dynamic class YourClass {
// Define the function this way:
this.yourFunction = function() {
return "abcd";
}
}
}
// Then to change the function:
var test = new YourClass()
trace(test.yourFunction()); // "abcd"
test.yourFunction = function() {
return "1234"
}
trace(test.yourFunction()); // "1234"
--
Laurent Cozic
Flash, Flex and Web Application development
http://pogopixels.com
----- Original Message ----
From: arieljake <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, August 5, 2008 11:18:53 AM
Subject: [flexcoders] Re: modifying a function at runtime
ehem...was a little sleepy when I wrote that. I meant...
Is it possible to modify the method of a class at runtime?
The only way I can think of is to encapsulate the function into a
Function property that gets called by a wrapper class method.