AS2 to AS3 converter: createTextField, getURL handling

Posted by HCL - RIA Group in

Draft of the AS2 to AS3 converter. Try it here, download it here.

the actionscript parser portion of the class to get it beyond a simple list of regex calls and more towards a smart converter. New features include:

  • Updates createTextField to new TextField() syntax. Sets x, y, width and height if they are not the default (0). Uses addChildAt unless getNextHighestDepth() is used for argument 2, in which case addChild is used. Parses the first parameter and uses it as the variable name unless it is not a simple string, in which case a temp name is used, and the original name is shown in a comment on top of the block. Pretty sweet.
  • Updates getURL to new URLRequest syntax. Works as above.
  • Updates var, function and class to public var, public function and public class to remove warnings as requested by my childhood hero Robert Penner. Parses the class to recognize block depth to not affect local vars and inline functions.
  • Smarter class and package name recognition.
  • Removes unnecessary imports in the same package as the current class.
  • Should properly recognize various line endings (crossing fingers).

The zip now includes a command-line executable called convertas2as3 for those Windows users who don’t feel like installing PHP. The zip is pretty big because it includes the php libraries for Windows users. On other platforms you can run the command-line utility in src/convert.php by typing php convert.php at the command line.

This entry was posted on Jul 11, 2008 at 1:03 PM and is filed under . You can follow any responses to this entry through the comments feed .

0 comments

Post a Comment