flex - Callable objects on ActionScript? -


is posible have callable objects on actionscript? example:

class foo extends eventdispatcher {   foo() { super(); }    call(world:string):string   {     return "hello, " + world;   } } 

and later...

var foo:foo = new foo(); trace( foo("world!") );    // not work 

why need this? (i'm not criticising, interested!) functions in as3 first-class citizens, , can passed around arguments.

e.g.

public function main(foo:function):void {     trace(foo("world!")); // work, assuming foo = function(str:string):string {...} } 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -