How to find out if ActionScript 1, ActionScript 2 or ActionScript 3?

I don't have a specific code example, but is there a general way to guess which version of ActionScript is a piece of code: 1 or 2 or 3?

I read somewhere that if it is encoded on a timeline, it is considered ActionScript 1.

+4
source share
3 answers

Update: My experience with AS1 / 2 is limited, and this is based on what I saw on the AS forums. From the comments, it seems that the second and third event processing methods are valid in both AS1 and AS2.

The syntax for event processing is different:

ActionScript 3

addEventListener(MouseEvent.MOUSE_UP, handleClick); private function handleClick(e:MouseEvent):void { //Just do it } 

ActionScript 2

 onRelease = function():Void{ //it not void - it Void //do something } 

ActionScript 1

 on(release){ //do something } 

You may find this page useful: Migrating from AS2 to AS3

The way to add new AS3 children is new followed by addChild

 var s:Sprite = new Sprite(); var tf:TextField = new TextField(); this.addChild(s); s.addChild(tf); 

Previously, these were the createMovieClip and createTextField - not sure about the exact version.

 _root.createTextField("mytext",1,100,100,300,100); //that is name, depth, x, y, width, height mytext.multiline = true; mytext.wordWrap = true; mytext.border = false; 

Previously, if you had the name property of a child, you can access the child from the parent using parent.childName , even if the parent class did not have a property called childName . With AS3, this is possible only if the parent class has a property called childName (of the appropriate type), and you assigned it a link to it (or you created this property in the dynamic MovieClip class). There is getChildByName() - but it will return the first child with the given name (and duplication of names is possible in the child list).

+7
source

There are many differences between AS3 and AS1 / 2, and in most cases you will see it immediately (look for addChild and addEventListener in AS3). The differences between AS1 and AS2, but far less obvious, but probably the most relevant for the language, are the introduction of the concept of a β€œclass” along with several statements and keywords for developing OOP (class, public, private, etc.).) .

EDIT: look, Wikipedia explains it a lot better:

2003-2006: ActionScript 2.0 The next major revision of the language, ActionScript 2.0, was introduced in September 2003 with the release of Flash MX 2004 and its corresponding player, Flash Player 7. In response to user demand for a language better equipped for larger and more complex applications, ActionScript 2.0 excellent compile-time checking and class-based syntax such as keywords and extensions. (While this allowed for a more structured object-oriented programming, the code would still compile ActionScript 1.0 bytecode, allowing for use in previous Flash Player 6 as well. In other words, the class-based inheritance syntax was layer on top of the existing prototype. ) With ActionScript 2.0, developers can bind variables to a specific type by adding type annotation so that type mismatch errors can be found at compile time. ActionScript 2.0 also introduced class inheritance syntax so that developers can create classes and interfaces since they are in class languages ​​such as Java and C ++. This version corresponded in part to ECMAScript Fourth Editing Project.

http://en.wikipedia.org/wiki/ActionScript#ActionScript_2.0

+2
source

Well, it doesn't just have to be ActionScript 1, which has timeline code. But an easy and quick way to check which version you are coding is to simply click the frame (empty or not) and press F9. He will say, on the left, which version is he (I'm sure ..) :)

0
source

All Articles