Both Javascript and AS3 are implementations of ECMAScript.
Is there a fundamental technical reason for Flash being so much more prevalent as a game-publishing platform, when compared to Javascript?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityBoth Javascript and AS3 are implementations of ECMAScript.
Is there a fundamental technical reason for Flash being so much more prevalent as a game-publishing platform, when compared to Javascript?
As with everyone else, I'm going to assume you mean Flash vs what's collectively being called the HTML5 technologies.
I believe Flash is still more popular because:
Momentum. Plenty of people who are interested in producing Flash type games are already well versed in Flash. People who are aspiring to create that sort of game are learning from them. Along with this comes a reluctance to switch for what seems like the sake of switching.
Environment. The Flash designer is an integrated package that deals with asset management, authoring of data like animation curves, editing scripts, compilation, optimization and packaging, all with relatively low friction. There is no real competing HTML5 based environment to work in. With HTML5 you're still looking at reinventing a lot of the wheel just to get started.
Robustness. HTML5, in its current state, is relatively new and still quite janky for game applications. The rules are constantly changing, which is exciting but not conducive to actually finishing a project. Flash, for better or worse, works as advertised. Its self contained graphics engine is several generations in, with support for all manner of advanced features, and should behave identically in all supported environments. HTML5 is a blank canvas still, and one that will behave differently depending on how it's viewed.
Reference materials. This goes hand in hand with the environment and momentum reasons above: there's plenty of stuff to learn from if you're making a flash game; years of articles, discussions and postmortems. There really isn't that much stuff that talks about HTML5 yet.
Flash is a lot more than ECMAScript. Although there were attempts to introduce some features of ActionScript into ECMAScript version 4, those were abandoned.
JavaScript only got usable for most type of games very recently. JavaScript in HTML5 nowadays offers:
But those things are provided by flash for a decade.
Originally developed by Macromedia, Flash was introduced in 1996, and is currently developed and distributed by Adobe Systems,
"Javascript" really means HTML 5, when compared to Flash:
The HTML5 specification was adopted as the starting point of the work of the new HTML working group of the World Wide Web Consortium (W3C) in 2007. This working group published the First Public Working Draft of the specification on January 22, 2008
(Emphasis added.)
Flash is a more established platform, and people are more used to using it to code games. In my experience, compiled AS3 running in the Flash Player runs much faster than Javascript running in-browser, and it offers easier access to things like sound and embedded files. Flash apps can also be encapsulated in a single .SWF file, while HTML5 apps written using Javascript tend to have a more complicated distribution method, since assets, scripts, and pages usually need to be separate files.
It's not entirely a fair comparison; Flash is compiled (to an extent), while Javascript is at best just-in-time-compiled for most web applications.
The semantic quibble Gregory made in his comment gets at the root of the issue here. Flash is a very established gaming platform because of the combination of ActionScript 3 and a host of powerful multimedia capabilities. While JavaScript was always just as good of a language, only recently has it been coupled with the powerful multimedia capabilities of HTML5.
As others are pointing out, you can compare ActionScript to JavaScript, and you can compare Flash to HTML 5, but comparing Flash to JavaScript is like saying "Which is better, Linux or C#?"
Most people back in the early AS2 and even AS1 days of Flash, were introduced via the Flash IDE. This was a great tool, were you could draw or import graphics, and add scripts very easily to get things happening very quickly. Macromedia (now Adobe) owes a lot of it popularity to this easy, graphics based entry point. There was not really much else out there that was even close (well, besides Director. Which I still love btw).
So Flash became a popular game creation tool before ActionScript was popular. ActionScript just provided a way to add the interactivity. The IDE is what really made it popular.
Things are different these days, at the platform has matured into many different part. It is now quite common to make Flash games without even touching the Flash IDE.
The biggest reason is because ActionScript contends only with the version of Flash you're using. You can reach a wide audience fairly quick with ActionScript in Flash because of the market penetration of some of the most recent versions of Flash (the adoption rate is quick). Now think about JavaScript; it is not a single implementation of ECMAScript, but several interpretations of the ECMAScript standard, which all depend not only on the browser, but browser version. Adoption rate for the updated browsers for a general audience (think IE) is very slow. It just makes more sense to choose Flash (or even Java) because it is more portable.