Table of Contents

J2AS - Java to ActionScript Converter

Purpose

This software enables you to use Java instead of ActionScript to create Flashcontent. This enables you to use the much better java toolset like refactoring and JavaDoc. Also, if you are a Java programmer, you’ll probably find it useful to be able to use Java instead of ActionScript. Though you still need to know the inner workings of flash to some extent.

Prerequisites

  1. Eclipse 3.1 including JDT from [http://eclipse.org]

Download

You can download the latest build from sourcesecure. The current size is 3.3 MB.

Installation

  1. Unzip the zip
  2. Copy the contents of the plugins-directory into Eclipse’s plugins directory.
  3. Restart eclipse

Test the installation

Test the installation

  1. Create a new Java project and point it to the j2as folder
  2. Make org.j2as.examples/src a sourcefolder
  3. Make org.j2as.lib/lib_java a sourcefolder
  4. Rightclick the project folder, select Properties/J2AS Properties and activate creation of ActionScript
  5. Select Project/Clean, select “Clean projects selected below”, select your project and press ok. Now all the as files should have been created ins yourProject/src_as
  6. Open org.j2as.examples/build.xml and adjust the pathes
  7. RightClick build.xml and select run As AntBuil to let mtasc compile the swfs. Now the example swfs should have been created inside org.j2as.examples/build

Whenever you change the Java source and save your changes, the corresponding ActionScript class in src_As should be updated now. Eg. open org.j2as.examples.SimpleExample and change iColor to some other beautiful color and save. Every change should be reflected in the corresponding class in src_as.

FAQ

What are intrinsic classes in lib_java?

The classes in the intrinsic package are only used to make the java code compile. They are not converted but supposed to exist already, like the built in MovieClip class or the interface of your favorite AnimationPackage (see AnimationPackage.org). In the final ActionScript the prefix intrinsic is removed from the package.

What is the content of lib_as?

Some features are realized in ActionScript currently. You need the classes in lib_as, to compile the Flashproject.

MTASC complains about missing classes?

Especially the addressbook example needs some intrinsic classes which are not part of the standard mtasc distribution. You can find them in the HAMTASC distribution at osflash.org. Or you try to copy the missing ones from src_as/intrinsic to MTASC’s std directory.

ToDo/Ideas

  1. Create a complete set of intrinsic classes which reflect the complete player api.
  2. Create more testcases for the conversion
  3. Replace calls to ObjectUtil.get/set by []
  4. Replace calls to ArrayUtil to the corresponding calls of array methods
  5. Maybe find a better solution to the anonymous function problem. Currently anonymous functions are defined as a string.
  6. If everything runs fine, convince ActionScript package providers to maintain intrinsic Java classes - or create a tool to automatically create the intrinsic Java classes
  7. Maybe add a template system for formatting the output
  8. Create an eclipse update site
  9. Write a real java to swf compiler
  10. Add errormessages for unsupported java features
  11. Support more java features
  12. Synch with asWing to enable Swing development
  13. Add ActionScript to Java converter to enable to work with old projects

Bugs

Please report bugs to the project mailing list

License

The plugin is published under the GPL.

Contributions

If you like to contribute, please send me a short mail to info@bokelberg.de

Donations

This peace of software is artware. If you like it and you like to donate something, create or buy a small piece of art and send it over to me. Drop me a line at info@bokelberg.de, and i’ll gladly send you my postal address. If you are not an artist or don’t like art for any reason :) but still feel the need to donate, you can also use my PayPal account and donate some money.

Projects using J2AS

If you use J2AS for a production, please advertise here.

Thanks

A big thanks goes out to Aral & Sourcesecure for kindly hosting this project at osflash.

Cheers, Ralf.