Table of Contents

as3converter

Summary

AS3 Converter is an ant task (or two) and a small collection of AS3 classes to aid porting an ActionScript2 project to ActionScript3.

We need to keep developing our main product in AS2, and will be for some time, however, I really want to port it. A code fork seemed too difficult, so a converter and an api compatibility layer that lets us develop them in tandem seemed the answer. I am having some success with it, and have had some working bits and pieces going.

It works by parsing an ActionScript2 source tree in to an in memory model of the source, then outputs it in ActionScript3 syntax, as well as applying some other conversions to make the code compile.

In the works

Now, if only someone could write an algorithm to remove all of my ReferenceErrors...

Tutorials

Download the example project at www.spikefin.org, and extract it somewhere. This will give you an idea of how the most basic project works, and is a good platform for seeing what you can and can’t do with the converter.

Run the example using the default target of the included build script.

Javadoc style directives

Besides the basic syntax changing, you can give the converter some extra instructions. These are declared using javadoc style properties, like @directive [param[=value]].

Class Directives

@convert true/false Tell the converter to skip this class

@equivalent className Tell the converter to use className as a substitute for this class.

In development

@strictArguments true/false Tell the converter not to add defaults to function parameters and var args to output code.

Method Directives

@default paramName=defaultValue Allows you to specify parameter defaults in the output methods signature.

@scope outputScope Specify the scope of the output method.

Demos

Download a sample project from Here

Download

Get it from the home page.

Discussion

discussion