views:

38

answers:

2

I'd like to automatically generate ActionScript classes for a flash client side of one of my projects. (These projects have a formal way of describing my models that is already used to generate SQL and a admin interface).

Now, the ActionScript should/could be compatible with ActionScript 2 and 3. Is there a description of a maximal common subset of features available somewhere?

+1  A: 

I think you will be stumped right of the bat, because AS2 and AS3 declare there classes/packages differently.

If you are looking to create Classes from templates, then I would suggest using FlashDevelop. It has a get templating system.

ActionScript 2 Class/Package example:

class com.yourpackage.YourClass extends MovieClip {
  function YourClass() {
    //contructor
  }
}

ActionScript 3 Class/Package example:

package com.yourpackage {
  public class YourClass extends MovieClip {
    public function YourClass():void {
      //contructor
    }
  }
}

But this is all just syntax. There are a lot more fundamental deferences between the languages than just formatting. There is also a different way of thinking.

TandemAdam
Thanks! Could you elaborate on the differences in class/package declaration?
Klaas van Schelven
Keep in mind that AS2/3 aren't just differing subsets of the same language. They're entirely different - the Flash player implements two completely different virtual machines to execute them. There are many places where the syntaxes overlap, but they are entirely coincidental, so if you restrict your code to those places you will be imposing very arbitrary restrictions on yourself.
fenomas
A: 

One possible alternative to enable you to do this, would be to use haXe.

stickupkid