I'm already using classes in external .as files, what else is so much better about AS 3.0? I looked on the Adobe website, but their descriptions of the new features were a little over my head..
Performance for AS execution is about 10x faster, which was not possible with AS2. Former versions of AS used the prototype as identifier and searched along what is called a prototype chain or tree to detect inheritance. In AS3 all inherited properties and methods of an instance are stored in the traits object, which results in the increased performance of the Flash player.
Forgive me for being a little ignorant - admittedly, I've not done a lot of looking into this - but how does one convert to the new ActionScript? Do I need to go out and buy a new version of Flash?
I hope that flash 9 is more then just a new verson of AS.
Also for the people that already have had there hands in AS3, is it all that much harder to learn then AS2. I mean is the curve bigger then befor? I really had to take some time to get the hole scope of AS2, in a way I'm still learning it.
Forgive me for being a little ignorant - admittedly, I've not done a lot of looking into this - but how does one convert to the new ActionScript? Do I need to go out and buy a new version of Flash?
If you have flash 8 you can download the flash 9 preview. Check the links in the resource threads.
If you don't have Flash 8, there is another way of doing it using Eclipse.
If you know AS2, AS3 is much easier to learn.
- The right of the People to create Flash movies shall not be infringed. -
I just downloaded and installed flash 9. When i ran my project on AS 3.0, as expected, I got a ton of errors.
A ton of these:
**Warning** The linkage identifier 'Boundry' was already assigned to the symbol 'Levels/Worlds/Boundries/World2/Levels/level_1_boundry', and cannot be assigned to the symbol 'Levels/Worlds/Boundries/World2/Levels/level_2_boundry', since linkage identifiers must be unique.
and a ton of these:
**Error** C:\Documents and Settings\XP User\Desktop\Donkey Rocket II\enemies\weapons\Rocket.as : Line 1, Column 22 : [Compiler] Error #1017: The definition of base class MovieClip was not found.
class Rocket extends MovieClip {
ReferenceError: Error #1065: Variable Timeline2_77fcb110f4fb664a9df544dfbd94a6cf is not defined.
ReferenceError: Error #1065: Variable Torpedo is not defined.
ReferenceError: Error #1065: Variable Control is not defined.
...
is this a semi-easy fix..or do i have to rewrite most of my code for AS 3.0?
In Flash 9 the original linkage identifier does not exist any more. Instead a class is associated with the object, since every object is a class. If the object, which should receive linkage id does not have a class associated, Flash will automatically do it. So I first write a class file with only the constructor and otherwise nothing.
When you convert your movie the first thing to do is clean up your stage.
Then you need to decide if you use OOP or not for your project. Generally I prefer OOP, but that is a personal choice.
Then you need to go through your scripts and check all old syntax.
- The right of the People to create Flash movies shall not be infringed. -
In Flash 9 the original linkage identifier does not exist any more. Instead a class is associated with the object, since every object is a class. If the object, which should receive linkage id does not have a class associated, Flash will automatically do it. So I first write a class file with only the constructor and otherwise nothing.
When you convert your movie the first thing to do is clean up your stage.
Then you need to decide if you use OOP or not for your project. Generally I prefer OOP, but that is a personal choice.
Then you need to go through your scripts and check all old syntax.
Could you explain that a little better? Where do you tell a movie clip what class it is?
When you say clean up your stage...what do i need to clean up?
Could you explain that a little better? Where do you tell a movie clip what class it is?
When you say clean up your stage...what do i need to clean up?
I'll give this a shot.
In Actionscript 2, if you had a movieclip in the Library that you wished to copy to the stage (using attachMovie() ), you would need to give it a "Linkage" identifier, which was Flash's way of determining which symbol in the Library you wanted.
In Actionscript 3, movieclips in the Library are actually classes. Classes are not copied to the stage with attachMovie() – instead, you say,
my_thingie = new thingie();
and in the Library, you give the movieclip you're using a class name (in this case it's "thingy"). So, when your code is executed, Flash will look for a class called "thingie" and will make an instance of that class called "my_thingie".
Classes have many benefits, though most of them apply to Object-Oriented Programming (OOP). However, for people who put code in the Timeline, this new way of attaching objects from the Library to the stage will make more sense when compared to the way one would create a new number, or a new string:
my_string = new String();
-like that.
So besides treating everything as a class, and performance improvements, what else does AS3 offer? Well, the event model has become more unified; in AS2, some events (like enterFrame) would use handlers, like onEnterFrame, while others (like MouseDown) would need listener objects, like Mouse.addListener(this) . In AS3, every event's code looks the same, and uses the same system to work. It's called the DOM3 Event Model.
Also, when objects in AS3 need to be displayed, they no longer use levels. A new movieclip will not automatically be drawn to the screen, which lets you take a load off the renderer. Removing a movieclip from the screen does not automatically delete it, which is sometimes nice (though sometimes troublesome too). And there is no longer a need to worry about overwriting a movieclip on a certain level with another movieclip being placed on that level.
So there're quite a lot of advantages to picking up AS3. Something important to remember, though, is that there is NO RUSH. AS3 is in its infancy, and AS1 and AS2 will work for years to come. It's more important to be knowledgeable in Actionscript than it is to drop what you're doing and pick up the next thing. Stay in your comfort zone, people.
Could you explain that a little better? Where do you tell a movie clip what class it is?
When you say clean up your stage...what do i need to clean up?
That is another thing not possible in AS2 but very useful, event bubbling.
Then the Delegate class is autonatically included in listeners, meaning the "this" word within functions refers to the class and not the listener object.
- The right of the People to create Flash movies shall not be infringed. -
Then the Delegate class is autonatically included in listeners, meaning the "this" word within functions refers to the class and not the listener object.
I'm already not liking the proposition. If your saying this.loadMovie("some.swf") is no longer valid.
Alright I finally decided to make the switch. But I'm having this problem:
**Error** C:\Documents and Settings\XP User\Desktop\Donkey Rocket II - v.9\enemies\Enemy.as : Line 3, Column 21 : [Compiler] Error #1017: The definition of base class MovieClip was not found.
class Enemy extends MovieClip {
What do I have to do to extend the MovieClip class?
EDIT: Fixed the above problem by adding
Code:
import flash.display.MovieClip;
to every class that extended movie clip. How would I import all the packages I needed in ONE spot and allow all my classes access?
EDIT2: I am also getting tons of these errors:
ReferenceError: Error #1065: Variable Bomb is not defined.
ReferenceError: Error #1065: Variable Control is not defined.
ReferenceError: Error #1065: Variable Bullet is not defined.
ReferenceError: Error #1065: Variable Napalm is not defined.
ReferenceError: Error #1065: Variable Torpedo is not defined.
ReferenceError: Error #1065: Variable DepthCharge is not defined.
ReferenceError: Error #1065: Variable Artillery is not defined.
These are all my movie clips which are classes. I'm not sure if this is right, but I went to Linkage -> class and typed in their class name. Shouldn't this make them point to my actionscript files? I have set up my actionscript 3 preferences, so Flash knows where they are...
EDIT 3: I tried to make my Game_Object class public, but I got an error stating that the "public" attribute can only be used inside a package. So how do I implement that?
In Actionscript 2, if you had a movieclip in the Library that you wished to copy to the stage (using attachMovie() ), you would need to give it a "Linkage" identifier, which was Flash's way of determining which symbol in the Library you wanted.
In Actionscript 3, movieclips in the Library are actually classes. Classes are not copied to the stage with attachMovie() – instead, you say,
my_thingie = new thingie();
I sure do have a lot of "Linkage" in my tilemap game
I have attached a little example of how one can start. It clarifies some of the points raised here. To put objects on stage you can use a document class. What was former _root is now this.parent.
If the class path is not correct for example, you will get an error like this:
ReferenceError: Error #1065: Variable Square is not defined.
In AS2 it was simple the class soandso could not be loaded.
- The right of the People to create Flash movies shall not be infringed. -