Posted on Saturday 5 November 2005
I've created a code generation template for AS2 as well as a base project for use with Enterprise Architect Professional or Corporate edition. Features include:
- Generates AS2 files with right folder structure
- Generates imports, supports packages
- Generates members, methods
- Generates classes and interfaces
- Carries over method comments
- Carries over method/member visibility attributes (private/public)
- Generates JavaDoc for class and methods
- Carries over types of arguments, returns, members
- Supports namespace root option
So basically it does just about everything that an UML to AS2 generator could do. Here's some sample output:
import clib.tools.Tool;
/**
* @author Patrick Mineault
* @version 1.0
* @created 05-nov.-2005 14:54:30
*/
class clib.tools.ArrowTool extends Tool
{
private var icon:MovieClip;
public function ArrowTool()
{
}
public function activate():Void
{
}
public function mouseDown():Void
{
}
/**
* This is a very complicated function!!! We might as well shoot ourselves instead
* of trying to implement it
*
* @param mc
* @param location
*/
public function transformPoint(mc:MovieClip, location:Object):Object
{
}
}
There are a couple of other UML to AS generation options that I tried before writing my own, but:
- Darron Schall's XMI2AS is only compatible with ArgoUML's XMI
- The XMI2ActionScript program listed on osFlash produces terrible-looking output and the author charges 300$ for source code (100$ more than a Enterprise Architect license!)
- The ArgoUML generator would have worked but that would have required exporting to XMI and importing in Argo, a bit of a pain
- I'd rather have the feature integrated into the program I use instead of having to run another program
- Mine supports imports!
The files can be downloaded here.
Setting up EA to work with these is a bit hard to explain, so I created two Captivate tutorials to show you how it's done:
Enjoy!


