Recent Updates
-
01
FEB 2011Transform SWF 3.0.2. released.
This is a maintenance release of Transform SWF for Java with fixes for several bugs and known issues. -
01
FEB 2011Transform SWF 2.3.4. released.
This is a maintenance release for the previous version of Transform SWF for Java and contains improved decoding of WAV files. -
30
NOV 2010Transform SWF 3.0.1. released.
This is a maintenance release of Transform SWF for Java with fixes for bugs when decoding JPG images and MP3 sounds. -
15
SEP 2010Transform SWF 3.0. released.
Version 3.0 of Flagstone's library for reading and writing Flash files now available. This release provides full support for all the features in Flash 10. -
17
MAY 2010Transform SWF 2.3.3. released.
This is a maintenance release fixing bugs when generating fonts with high-value Unicode characters and improving support for Macintosh.
Transform SWF for Java
Transform is an Open Source library for reading and writing Flash (.swf) files. The API gives you complete control over how files are created with access to all the features supported by the Flash Player but yet is still intuitive and easy to use.
Key Features
- Full support for Flash 10.
- Access to all of Flash giving full control of the Player.
- Generate Flash files for any version of the desktop Flash Player.
- Generate Flash Lite files for mobile phones and devices.
- Easy to use API allows you to edit any flash file.
- Comprehensive 2-D API to draw shapes from arbitrary complex paths.
- Use OpenType or TrueType fonts to display text.
- Direct support for generating images using JPEG, PNG and BMP files.
- Add Event and streaming sounds from WAV and MP3 files.
- Plugin architecture for adding decoders for new image and sound formats.
- Java JDK integration adds support for AWT Fonts and ImageIO readers.
- Open Source, BSD licence is free for commercial use.
An Example
Here is an example showing how to use Transform for Java to generate a flash file that displays a text field. For more examples, detailed information on Flash concepts and How-Tos take a look at the Cookbook.
int uid = 1;
int layer = 1;
final String str = "The quick, brown fox jumped over the lazy dog."
final Color color = WebPalette.BLACK.color();
final String fontName = "Arial";
final int fontSize = 24;
final int fontStyle = java.awt.Font.PLAIN;
// Load the AWT font.
final AWTDecoder fontDecoder = new AWTDecoder();
fontDecoder.read(new java.awt.Font(fontName, fontStyle, fontSize));
final Font font = fontDecoder.getFonts().get(0);
// Create a table of the characters displayed.
final CharacterSet set = new CharacterSet();
set.add(str);
// Define the font containing only the characters displayed.
DefineFont2 fontDef = font.defineFont(uid++, set.getCharacters());
// Generate the text field used for the button text.
final TextTable textGenerator = new TextTable(fontDef, fontSize * 20);
DefineText2 text = textGenerator.defineText(uid++, str, color);
// Set the screen size to match the text with padding so the
// text does not touch the edge of the screen.
int padding = 1000;
int screenWidth = text.getBounds().getWidth() + padding;
int screenHeight = text.getBounds().getHeight() + padding;
// Position the text in the center of the screen.
final int xpos = padding / 2;
final int ypos = screenHeight / 2;
MovieHeader header = new MovieHeader();
header.setFrameRate(1.0f);
header.setFrameSize(new Bounds(0, 0, screenWidth, screenHeight));
// Add all the objects together to create the movie.
Movie movie = new Movie();
movie.add(header);
movie.add(new Background(WebPalette.LIGHT_BLUE.color()));
movie.add(fontDef);
movie.add(text);
movie.add(Place2.show(text.getIdentifier(), layer++, xpos, ypos));
movie.add(ShowFrame.getInstance());
movie.encodeToFile("example.swf");