You are here: Recent News » Projects » as3converter

 

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.

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.

  • Rewrites AS2 classes in AS3 syntax
  • Automatic ‘override’ inserting
  • use @scope javadoc tag to change output function scope
  • use @default to insert parameter defaults in to output function
  • ability to specify AS3 equivalent classes, such as MovieClip → as2.toplevel.MovieClip, or org.chaps.MyStringLibrary → org.chaps.utils.MyStringLibrary.
  • ‘Void’ to ‘void’
  • Small collection of compatibility classes to provide api compatibility
    • MovieClip
    • TextField
    • Stage
    • Mouse
    • ...
  • Ant task that uses swfmill to create an AS3 asset library class using an existing swf.

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.

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

projects/as3converter.txt · Last modified: 2007/05/06 02:58 by nicobrevin