A Flash Developer Resource Site

Page 1 of 4 1234 LastLast
Results 1 to 20 of 68

Thread: Is AS 3.0 that much better?

  1. #1
    Senior Member J-Rad's Avatar
    Join Date
    Jun 2006
    Posts
    124

    Is AS 3.0 that much better?

    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..

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    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.

    http://livedocs.macromedia.com/labs/...=00000057.html

    There are a lot of other changes such as easier use of XML etc., but performance is a big issue.
    Last edited by cancerinform; 08-18-2006 at 08:36 PM.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3

  4. #4
    Registered User greenham's Avatar
    Join Date
    Mar 2005
    Location
    Australia
    Posts
    555
    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?

  5. #5
    if($<0){WelcomeToMyWorld} joshchernoff's Avatar
    Join Date
    Jul 2005
    Location
    Portland
    Posts
    321
    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.

  6. #6
    Custom User Title Incrue's Avatar
    Join Date
    Feb 2004
    Posts
    973
    Its not that hard

  7. #7
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Quote Originally Posted by greenham
    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. -

  8. #8
    Senior Member J-Rad's Avatar
    Join Date
    Jun 2006
    Posts
    124
    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?

  9. #9
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    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. -

  10. #10
    Senior Member J-Rad's Avatar
    Join Date
    Jun 2006
    Posts
    124
    Quote Originally Posted by cancerinform
    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?

  11. #11
    Member
    Join Date
    Nov 2004
    Posts
    48
    Quote Originally Posted by J-Rad
    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.

  12. #12
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Quote Originally Posted by J-Rad
    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?
    download the example here, check the properties of the movieclips in the library.
    http://flashas3.flashscript.biz/even..._bubbling.html

    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. -

  13. #13

  14. #14
    Flashkit historian Frets's Avatar
    Join Date
    Oct 2000
    Location
    flashkit
    Posts
    8,797
    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.

  15. #15
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    Quote Originally Posted by Frets
    I'm already not liking the proposition. If your saying this.loadMovie("some.swf") is no longer valid.
    loadMovie doesnt exist in Actionscript 3 but if it did, then this.loadMovie would work exactly as it did in previous versions of actionscript.

  16. #16
    Senior Member J-Rad's Avatar
    Join Date
    Jun 2006
    Posts
    124
    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?
    Last edited by J-Rad; 08-29-2006 at 04:34 PM.

  17. #17
    newb of many sorts Ralgoth's Avatar
    Join Date
    Apr 2002
    Posts
    466
    Quote Originally Posted by mRNA
    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

  18. #18
    newb of many sorts Ralgoth's Avatar
    Join Date
    Apr 2002
    Posts
    466
    with attachMovie you could define all of the properties with one line. Can you do that with classes?

    example...

    shopMovie.attachMovie("WildPop", "WildPop"+i, i, {_x:60*i, _y:0, CMB:i, CLR:j, STL:k, NUM:whatever, CART:true});

  19. #19
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Ok,

    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.
    Attached Files Attached Files
    - The right of the People to create Flash movies shall not be infringed. -

  20. #20
    \x3a\x6f\x29
    Join Date
    Sep 2005
    Location
    paris
    Posts
    88
    Quote Originally Posted by Ralgoth
    with attachMovie you could define all of the properties with one line. Can you do that with classes?

    example...

    shopMovie.attachMovie("WildPop", "WildPop"+i, i, {_x:60*i, _y:0, CMB:i, CLR:j, STL:k, NUM:whatever, CART:true});
    Of course. And it would be a beauty like this

    Code:
    var wildpop: WildPop = new WildPop( shopMovie, 60 * i, 0, i, j, k, whatever, true );

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center