Wow, I stumbled across this quote on the Macromedia LiveDocs for Flash MX 2004. Don't hate the messenger, this is straight from the horse's mouth.
The quote below can be found on this page: http://livedocs.macromedia.com/flash/mx2004/main/appx_e_a.htm
"If you have never used ActionScript to write object-oriented scripts and don’t need to target Flash Player 5, you should not use the information in this appendix, because writing object-oriented scripts using ActionScript 1 is deprecated; instead, see Creating Classes with ActionScript 2.0 for information on using ActionScript 2.0."
What this means is that Macromedia is really pushing ActionScript 2 syntax. Instead of writing classes like this:
function myClass() {
// constructor
}
myClass.prototype.myMethod = function() {
// do stuff here
}
You should adopt the ActionScript 2 syntax and create them like this:
class myClass {
public function myClass() {
// constructor
}
public function myMethod() {
// do stuff here
}
}
So, if you're still using ActionScript 1 for Object Oriented Programming in content geared for Flash 6 or 7, Macromedia has deprecated the syntax. When syntax is deprecated, this usually means that it will no longer be supported and not guaranteed to work in future versions. Note that using prototypes is not deprecated, but defining classes via the prototype is.
I'm wondering if the deprecation is to get everyone on board with the same syntax now, or if Macromedia is planning on abandoning the prototype model behind-the-scenes completly? Maybe a combination of both? Maybe some entirely different reason? I doubt they'll re-write how classes are implemented behind-the-scenes in the Flash Player, and I don't think the prototype is ever going away (nor should it). I think that this is just a push to make sure everyone is using the latest and greatest syntax, but this is just my opinion.
Have you switched yet?

9 Comments
I won't hate the messenger!
Posted by: Dominick | December 1, 2003 2:12 PM
After buying three books on AS 1 (including the Hall and Wan OOP book) and getting my meager RIA's working, well, no, I won't be switching to AS 2 anytime soon. I imagine this will be a bit like getting Mac Owners to move to OS X -- it would be nice, but who has the money and the time ?
Posted by: Kirk Mower | December 1, 2003 4:39 PM
" I think that this is just a push to make sure everyone is using the latest and greatest syntax, but this is just my opinion."
mine too!
:)
no, I haven't switched ... but I become anxious about it ;)
Posted by: cedric | December 1, 2003 5:16 PM
The sentence "ActionScript 1 is deprecated" is probably an unintentional mistake that will be corrected by MM. Currently, when we speak of ActionScript 2, we only speak of the new additions and changes in the lexical structure of the language. The compiler is able to parse class-based syntax and optional type annotation, spawn error messages when needed and compile AS 2.0 code to bytecodes that are backward compatible with version 6 of interpreter. At the runtime level, the language reflects prototype-based, non-typed nature of EcmaScript v.3. As documented by MM, they are only three new bytecode instructions added to swf 7 specs, for example *extends* works at the prototype level (so that class instances can have a property such as *__proto__* in AS 2.0). If we compare the situation to JScript .NET, we will see that class-based objects and prototype-based objects are radically different, the former being CLR compatible, lacks the dynamic features of the second. In JScript .NET, a class instance doesn't have properties such as *prototype*, *constructor* etc. Supporting class-based object creation and run-time type checking at the bytecode interpeter level will require lots of work and probably a re-write of an important part of the stack machine. For sure, AS 2.0 syntax has its advantages when it comes to structure a complex application that will be maintained by a group of developers. But we have to admit that, at the time of writing, AS 2.0 is a prototype-based language in the clothes of a class-based language.
Posted by: Ahmet Zorlu | December 1, 2003 8:25 PM
Ahmet,
Your comments are well taken. I was careful to state that "... using prototypes is not deprecated, but defining classes via the prototype is" because I didn't want to give the wrong impression. I know that ActionScript 2 is "syntactic sugar" as Branden called it, and that it really boils down to prototypes behind the scenes.. doing it any other way would require a major re-write of the player.
However, I don't believe it was a mistake on Macromedia's part at all. I doubt they would've introduced ActionScript 2 knowing they would have to fully support both models in the future. It's pretty clear that they're headed in the ActionScript 2 direction, and they want to bring the developer community with them.
Does anyone from Macromedia care to respond?
Posted by: darron | December 1, 2003 8:36 PM
Well, most flash 4 features and functions were deprecated in flash 5 but they are all still available today. Does anyone still use them I dunno but I'm sure very few do especially when it comes to sharing code. That's probably the main case for moving to as2 is if the majority adopts it but so far I hear more people saying they're sticking to as1. I've made the switch but my code is not very as2 strict, there's still things I gotta use that's considered as1.
Posted by: David | December 2, 2003 9:18 AM
i know this is the wrong place but i am looking for someone with action script expertise to help with a flash, php, app. can someone please help me?
cheers
Posted by: bill | December 3, 2003 9:49 AM
Well, I just bought two books on Flash - with AS1 samples. I scratched my head for a bit (I hated the syntax) - did some searching on the web, and came accross some AS2 samples.
Then I felt at home! (Being a C++,PHP coder) And I am porting some .Net/PHP code with hardly any hassle. (A chess move validation engine)
Yes, I have probably wasted some money on the books, but I would hate to learn a dead syntax. I'm so very pleased I chose to learn Flash early 2004 as AS2 is available...
-Russ
Posted by: Russ | January 9, 2004 5:57 AM
Ahmet is right.
Personally i don't like classes... i like too much AS1 because it's more like C.
Object oriented languages are for people who wants to make big things and they only make small things...
My two cents
Posted by: ChRoNo | May 10, 2006 2:39 PM