Migrating AS1.0 to AS2.0

By sgrosvenor
We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now

If you are working intensively with the new Flash MX 2004 components in your applications or just wishing to follow a more strict development environment for your applications, then AS2.0 is something that you just can’t get away from, but what I’m interested in hearing from the Sitepoint Flash community is how many of you have progressed to the dark side , and what problems you faced in your migration.

Alternatively if you haven’t made the move to AS2.0, what are your reasons (time, no need, project constraints etc?)

We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now
  • Jim Cheng

    I switched over to coding in Actionscript 2 shortly after I adopted MX 2004 as the platform of choice for new client work and personal work on open source projects.

    The transition for me went very smoothly and I was up to speed working in AS2 in a matter of hours. Then again, I come from a C/C++ background and have been familiar with OOP methodology and strict typing for years prior to becoming an Actionscript developer.

    I routinely switch between AS1 and AS2, using the former when working on legacy projects and very simple scripting (e.g. adding some looped animation) and using AS2 for all new projects of any serious complexity.

    Actionscript 2’s strict typing and class packaging certainly do make for significantly easier code-reuse in larger projects. My only real complaints are the continuing lack of full preprocessor directive support (e.g. #if) and the lack of a simple and elegant way to have supporting classes dynamically linked at run-time, which wholly defeats the point of easily using shared libraries with classes.

  • JesterXL

    I hate AS2 at first; I thought it was slow to develop in, and required all this extra bs. However, now i hate AS1, and will never go back. I have a hard time, now, even writing simple stuff, like Jim mentioned without at least defining my function return types, etc.

    Regardless, Flash is acting like Director would; once you actually fix all compile errors, your shiot usually works the first time. That to me is insane in time savings.

    The big problems I had were knowing the scope mappings, like so:

    MyClass.cow | static var cow

    MyClass.prototype.cow | var cow = “value”

    a = new MyClass();
    a.cow = “sup”;

    // inside of class file
    public var cow;

    function init()
    cow = “defaultValue”;

    I love AS2.

  • sgrosvenor

    Jesse / Jim, great comments which just goes to underline my initial thoughts on the subject that whilst the transition from traditional programming environments (Java, C++ etc )to AS2.0 is a relatively painless one due to the OOP based structure the user is already used to, initially it was quite a leap of faith for many of the AS 1.0 stalwarts, which few have managed to make.

    I especially think, that if someone has has limited exposure the the Flash programming environment, and they come in with Flash MX 2004, then the learning curve for them to create AS2.0 based projects is going to be pretty high.

    It’s swings and roundabouts really, but I certainly think that most users with a design background if they are not especially strong in programming will struggle to create AS2.0 based applications without extensive wizards

  • webhornet

    i like the new oops features. you now can bind symbols to self-coded classes to extend their abilities.

    read this cool article! it’s a real eye opener :)


  • Binding symbols to self-coded classes is something that’s always been possible in AS 1.0. As Kirupa points out, it just means using Object.register. I got comfortable using that system a long time ago. I’m just not as excited as everyone seems to be about the “real” OO in AS 2.0– perhaps because I’m not a Java developer.

    I’m one of those fellows that is having a hard time jumping over to AS 2.0, but mostly because I don’t want to require my users to have the newest Flash player.

    There’s a good discussion about this here: http://www.bitchwhocodes.com/mt/archives/000167.html