is it posible to have callable objects on ActionScript? For example:
class Foo extends EventDispatcher
{
Foo() { super(); }
call(world:String):String
{
return "Hello, " + world;
}
}
And later…
var foo:Foo = new Foo();
trace( foo("World!") ); // Will NOT work
As others had said, you can’t have callable objects. However, if for some reason you want to have stateful functions, you can achieve it with help of static class variables and package level functions. For example:
When used, it will print different things.