Camilo has posted 1 posts at DZone. View Full User Profile

From Java to ActionScript 3 - Part 1

  • submit to reddit

I have been a dedicated Java developer for over 5 years. Not only that, but I consider myself a Java enthusiast. For several reasons, however, I have decided to start a project in ActionScript 3 using Flex Builder 3.

I consider valuable to share my impressions on the transition between the languages. Therefore, in this series of posts I will be writing about my experience with ActionScript. I will also comment on the differences between the development tools for Java in Eclipse and Flex Builder, as they both use the Eclipse as an underlying technology.

Before I start, however, I should note that both Java and ActionScript 3 have their on strengths and weaknesses and I consider both of them amazing technologies. I will try to be as objective as possible to avoid sinking in "religious" arguments. Also, in this series of articles, I will refer just to ActionScript 3, not the previous versions of the language, as I have no experience using them. Therefore, whenever I refer to ActionScript (or AS) I will be talking about ActionScript 3.

In today's post I will refer to some impressions about the development environment. For ActionScript and Flex I am using Flex Builder 3. For Java, I am using Eclipse Ganymede. 

Let's start.

Flex Builder performance

The compiler for Java in Eclipse if far faster and provides better feedback than the ActionsScript 3 compiler. For instance, in Java it underlines the syntax errors and provides quick fixes as you type. FlexBuilder, on the other hand, only compiles when you save a file and just indicate the line of the error and does not give any quick fixes. The most annoying thing, however, is the speed. With a medium size project, the saving can take several seconds in my machine (Mackbook pro with 1.5Gb of RAM) which is really bud. I seriously hope that adobe improves this in the future.


Refactoring for AS is still in diapers. Basically, the only tool that they offer is Rename. Java, on the other hand, has very sophisticated refactoring tools, making this process a pleasure.


Documentation in AS is more enjoyable to use than Javadoc. The template of ASDoc looks better than Javadoc. But the differences goes beyond that. In the bottom of each documentation page, there is space for comments and examples. Furthermore, many AS examples contain flash apps embedded on them, showing the running code of the examples. This is very rare in Java, except in the applets tutorial, and they are too slow to load to make them practical.

Interface design

Design view It works amazingly. This, together with the binding capabilities, make the creation of UI a pleasure in Flex. You can drag and drop the elements and see the final result right away. The layout behaves just as you expect, so you don't have to struggle with the layout manager for hours as with Swing.

However, it is a shame that you don't get previews of custom components (unless you extend a normal component).

More to come..

In the next part of my review, I will talk about language features including how I began to love closures and how much I miss abstract classes. Stay tuned and don't forget to leave your comments and visit my blog for other cool articles!

Published at DZone with permission of its author, Camilo Arango. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Jacek Furmankiewicz replied on Thu, 2008/07/10 - 7:31am

Thanks for the intro, I've been meaning to look into Flex in general in absence of a working Java-based RIA alternative.

Just a minor negative comment about "you don't have to struggle with the layout manager for hours as with Swing" line...that comment is true....but only if you're not using MigLayout. :-)

With MigLayout, any other Swing layout manager looks like a clumsy toy.


Java Guy replied on Thu, 2008/07/10 - 8:41am

I have to disagree with you about the design.  FBuilder design wysiwyg is very good for simple to to slightly more than simple interfaces and tutorials that Adobe people have done.  But outside of that, in real world design w/ real world users I've found that 95% of my screens have to be hand coded mxml to get the view you want.

Ricardo Soares ... replied on Thu, 2008/07/10 - 9:26am

I think you should explain your reasons to adopt ActionScript and FlexBuilder to develop your project.

Jacek Furmankiewicz replied on Thu, 2008/07/10 - 10:14am in response to: Ricardo Soares de Lima

Have you tried developing any JavaFX in Eclipse? That alone should answer your question :-)

John Denver replied on Thu, 2008/07/10 - 10:21am

Swing Layout manager's are the more advance and greatest on the history of GUI programming. Also Swing is multithreaded, Flex because flash vm is singlethreaded, I dont think Flex can compete with Swing the only thing that is nice for some people about Flex is the declarative mxml of gui but other things I think Swing wins hands down as GUI framework.

 By the way, Im agree with one post in the real world projects with flex you end coding by hand the mxml and not using flexbuilder.

Go with Swing and Miglayout and it will save you many headeches and with the java 6U10 it will rock the applets for the web and apps for the desktop.


Collin Fagan replied on Thu, 2008/07/10 - 10:27am

"you don't have to struggle with the layout manager for hours as with Swing"

Your statement is interesting as I found that there was very little new and exciting about layouts in Flex. In fact I found more similarities then differences.

Even with the similarities Flex takes a very naive approach to layout. It makes a lot of things seem simpler, but that does you a disservice becouse the problem of screen layout is actually rather complicated.

J S replied on Sun, 2011/06/05 - 12:40pm

As someone who has used by Java AND Flex/ActionScript extensively for years I can't help but address some of the comments above:

MigLayout - Nicer than other Swing layouts sure, but it still doesn't get around the fact that Java source is simply inefficient and needlessly verbose when it comes to UI design.

@Java Guy - In my experience it's more like the other way around. Unless you're doing some *very* unusual or complex UI (in which case no "designer" will ever meet your needs), FB's design mode works fine if you take the time to learn it.

@Ricardo - Java is a generalized software solution, usable for many things, but not always ideal for every possible use case. (If it were, it'd be the only language by now.) The Flash platform and Flex/ActionScript are specialized, targeted at UI development. Is it really a surprise that it wins in the front-end aspect of RIAs? Java is notorious (in the minds of users) for providing crap UI experiences. Flash on the other hand is on almost every web page we visit.

@John Denver - Clearly you've never actually given Flex or ActionScript a fair chance or made a serious attempt to learn about it. The single threaded aspect is practically meaningless in a UI context, and other features are FAR more important to consider. Flash is single threaded intentionally, to avoid the pitfalls and complexity of multithreaded programming. You have to be kidding when you say "Swing is more advance and greatest on the history of GUI programming". Every user I've ever talked to says that Java GUIs are CRAP. And a major reason is that Swing developers don't understand how to deal with the multithreaded aspect of Swing apps, how to properly interact with the event dispatch thread, correctly use SwingWorker, and so on. Another reason is that it requires too much work and boilerplate to add user productivity features. Yes, you CAN add the "productivity frills" you need, but it's not likely to happen on a tight schedule if it's not trivial to implement. Swing development is practically a dead skill set now, for good reason. And when "coding by hand the mxml"--(which by the way is 1000x more efficient than coding Swing by hand as you often need to do)--you're still using Flash Builder, with autocompletion, syntax highlighting, refactoring, and so on. I'm not a fan of using XML everywhere, but for UI design MXML just makes sense and vastly reduces the size and complexity of your code base. Not to mention all the productive features ActionScript has built in which avoids the god awful Swing bloat needed in Java. It's easy to think Swing is as good as it gets when you haven't even tried a modern alternative.

@Collin - Swing layout is much, much more complicated in Java actually. Whenever I'm working on a Swing app (rare these days) I can't help but think about how much easier and faster it'd be to do the UI in Flex. Java UI dev doesn't even come close to Flex dev, it's painful using Swing once you've learned Flex.

Java is still king on the server of course and for tasks that actually do need multithreading (NOT UIs), but in the UI world you should do yourself a favor and use a more modern SDK and platform.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.