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

You are correct. In fact, pre-AS1, Flash Actions were a dramatically different VM. If you wanted to store a property on an object you had to use slash paths. "../hero:gun/bullet" would go up one clip, look for something called hero, look for a gun on the hero, and then a bullet in the gun.

Macromedia beat Actions into something that could vaguely-resemble an ECMA-262 3ed language runtime if you squinted hard enough. However, all of the old warts still remain, probably because otherwise you couldn't upgrade from Flash 4 and compile to newer SWF versions. Thus, Actions, ActionScript, and ActionScript 2.0 all compile to the same VM. The only difference in semantics come if you compile to a newer or older Flash Player version.

AS3 is an entirely different VM that actually was designed to serve as the runtime for the 4th edition of ECMAScript, which never actually came out because web developers thought it was way too complicated. However, the only features that never actually made it into modern JS are namespaces, interfaces, and prototype-free classes. Everything else did eventually make it back into ES5 or ES6, albeit in dramatically different ways[0] sometimes.

[0] For example, when you declare a `class` in modern JavaScript, you are actually invoking syntactic sugar (mostly) for declaring a constructor function, setting the prototype to an instance of the parent, and then populating methods on the prototype. This is also how AS2 did it, too.

In ES4, they instead decided to completely junk prototypes in favor of Java-style inheritance. When you declare a class, you're creating an actual Class with a vtable and everything. It's instances actually get copies of their methods with `this` properly bound, which you can shove directly into `addEventListener` and `removeEventListener` and expect to work.



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

Search: