Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"but I think it was removed in as3"

Wrong. I was curious so i tested it (i've been experimenting with Flex 2). The following code outputs "blah blah":

var foo:Function = function() {}

foo.prototype.someMethod = function() { trace("blah blah"); }

new foo().someMethod();

I think the prototype syntax was kept to maintain backwards compatibility.



Thats cool, does it work with creating classes that way as well?


im assuming the above code is equivalent to:

class foo {

  public function someMethod() { trace("blah blah"); }
}

new foo().someMethod();

just different approaches to the same problem




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: