Ok, I have a class like this:
public class Foo extends Sprite {
public function Foo(x:Number, y:Number):void {
this.x = x;
this.y = y;
}
public function bar():void {
trace("I'm a happy class.");
}
}
And I want to do something like this:
var foo:Foo = new Foo();
foo.bar = function():void {
trace("I'm a happier class.");
}
I'm getting this error from the compiler: "Error: Illegal assignment to function bar". How can I change the public function bar on the fly?