Clicky

Announcing Flash4j 3.0 (Beta)

*** Flash4j 3.0 GA announced ***

Give developers the ability to write incredible applications regardless of the target platform has always been Emitrom's goal. We aim to provide you with free and powerful tools that will boost your productivity. We recently released Touch4j and Titanium4j Mobile to give you the ability to write HTML5 and/or native mobile applications.

Today we are announcing another powerful tool for developers targeting the regular desktop browser. Meet Flash4j 3.0

When it comes to rich and interactive content for the desktop browser the flash platform is still one of (if not the) best platform on the market. But the close bond between the Flash platform and ActionScript has made it less accessible for other developers (especially Java developers). Flash4j is here to fix this situation. It started as a Java API for Apache Flex, except now we are adding support for other Flash-based libraries to give you even more capabilities. In this release we rewrote the framework from the ground up, fixed a handful of bugs and added an entire set of new features. Lets take a look at some of the most prominent ones.

Automatic Flash capabilities detection

Flash4j 3.0 ships with the ability to automatically detect if Flash is available on the target device. Meaning that for device where Flash is not installed or allowed (iOS, for instance) Flash4j will not even enter the loading mechanism, saving the user from unnecessary waiting time and giving developers the possibility to implement a fallback(HTML5).


Cleaner, simpler and more intuitive API

In 2.0 the API looked as follows: Button button = Button.newInstance("Click Me"); button.addClickHandler(new FlashEventListener<MouseEvent>() { @Override protected void onFlashEvent(MouseEvent event) { Alert.show("Hello, Flex", "Greetings"); } }); // center the button button.setHorizontalCenter(0); button.setVerticalCenter(0); While this was working pretty well, it had some limitations. First, Components were created through factory methods and not contructors. And because all objects were mostly thin wrappers around GWT JavaScriptObjects, extending them to create custom composites was not possible. Below is a taste of what the new API in 3.0 looks like: Button button = new Button("Click me"); button.addEventHandler(MouseEvent.CLICK, new EventHandler() { @Override public void onEvent(Event event) { Alert.show("Hello, Flex", "Greetings"); } }); // center the button button.setCentered(); As you can see, button is now a first class Java object with a real constructor. Because all components are now real java objects, they are easy to extend.

Starling Support

Flash4j 3.0 introduces support for the incredible Starling Framework, giving Java developers the ability to write powerful GPU accelerated 2D Flash Games. The framework will also ships with a real world demo and its source code.

Apache Flex Support

Flash4j 3.0 enhenced its support for Flex by not only rewriting the API from ground up but also by updating the underlying framework to Flex 4.8 , the official release under Apache . On top of that we are implementing a brand new Explorer to bring you more then 100 demos with source

Support for the GreenSock Tweening library

The Greensock library is one of the most powerful tweening and animation library on the Flash ecosystem. We are trilled to announce that this library will be available in Flash4j 3.0, allowing you to write stunning animations with a simple API. TweenMax.to(myComponent, 1, TweenMaxConfig.create().setHeight(100)).addEventHandler(TweenEvent.COMPLTE, new EventHandler() { @Override public void onEvent(Event event) { Window.alert("Tween complete"); } });

Support for clientside file read/write

Beeing able to read and write files on the client is a usefull features for web applications. Flash4j 3.0 improved client-side file generation by supporting generation of PDF and Excel files on the client. private void writeFile(String content, String format) { if (format.equalsIgnoreCase("text")) { writeTextFile(content); } else if (format.equalsIgnoreCase("pdf")) { writePdfFile(content); } else if (format.equalsIgnoreCase("excel")) { writeExcelFile(content); } } private void writeTextFile(String content) { Application.get().saveFile(content, "export.txt"); } private void writePdfFile(String content) { PDF pdf = new PDF(); pdf.addPage(); pdf.writeText(content); Application.get().saveFile(pdf.save(), "export.pdf"); } private void writeExcelFile(String content) { Sheet sheet = new Sheet(); sheet.resize(10, 10); sheet.setCell(0, 0, content); ExcelFile excelFile = new ExcelFile(); excelFile.addSheet(sheet); Application.get().saveFile(excelFile.saveToByteArray(), "export.xls"); }

And much more ....

This release contains a tons of other useful features that we will be showcasing in upcoming blog posts. We also can't wait to see the amazing stuff that you will build with the new functionalities. Flash4j joins the ranks of the Emitrom portfolio as a free and open source product as well.

Dont wait too long. Get Flash4j from here and build amazing stuff :)

Happy coding!