Hybridizing Java sounds sexy but learning ActionScript ... not so much. In this two-part article, Chet Haase gets you started toward the Great Migration, with a Java developer's perspective on what's different about ActionScript 3 and its flashy, scripty syntax. In Part 1: An overview of ActionScript 3 and how its basic syntax and class behavior differs from Java's. In Part 2: An advanced look at how ActionScript handles properties, dynamic behavior, and functions. Level: Intermediate
About a year ago, I packed up my things and moved dimensions. I went from programming full-time in Java to working on the Flex team at Adobe, where I now program in ActionScript 3. I was looking forward to the change because I think that an occasional radical shakeup usually works out well, unless you're talking about babies or champagne bottles.
But I wasn't quite so sure about the language barrier.
I'm not an expert in programming languages -- at all. I'm just a graphics geek who learns enough about languages to get the job done. And I figure we can all do what we need to in any language as long as we understand the rules and constraints. But I did come to the new platform with a just a tad of supercilious Java bias, thinking "Isn't ActionScript that toy language that designers use for sprinkling code into animations in the Flash authoring tool?" I mean, any language with script in its name is obviously going to be a step down from the mighty Java. (Or, as Neil Young put it in his surreal cameo appearance at JavaOne 2008, "The Jay-va.") Right?
I was therefore pleasantly surprised to find that ActionScript 3 is actually quite a powerful language, and was syntactically similar to Java in many ways (see Figure 1). Yes, it's a scripting language with dynamic behavior and less type strictness than we have come to expect from Java. But it also has a lot of similar type behavior, object-oriented structure, and package/class/method/field organization that makes it look, well, almost Java-like.
So while I'm not a language expert (I'll keep emphasizing that, to make sure that nobody sends me questions about lambda expressions or BNF grammars or anything else I can't answer), I thought that it would be useful to take a step back from both languages and compare them from this programmer's point of view. I'll compare various aspects of the languages to see what ActionScript 3 looks like to a Java developer. In so doing, I hope to help you avoid some of the pitfalls and misconceptions I encountered in my own migration to the Flex SDK.
The goal of this article is not to depict one language as better than the other. I think that all languages have their place (I could throw in an unkind jibe here about some older or untrendy languages, but I will pretend that I am above that). Instead, I just want to examine things that are similar and different about Java and ActionScript 3, and what these characteristics contribute to how we use each language.
halloweenBy halloween on October 16, 2009, 7:22 amTop 10 Halloween Costumes 2009 ideas
Reply | Read entire comment
Re:By couples on October 5, 2009, 6:03 pmFest Couples Halloween Costumes 2009 for sale
Reply | Read entire comment
JavaFX- I need to give it aBy Jordan2009 on September 28, 2009, 10:13 pmJavaFX- I need to give it a try. I have heard about it from other sites as well. It seems a good offer for the users. Puppies for sale
Reply | Read entire comment
CastingBy Anonymous on February 20, 2009, 10:13 amOne thing it took me a while to realize is that there is a difference between the two methods of casting: var g:int = int(f); will throw an exception if f is not...
Reply | Read entire comment
Comparing JavaFX Script to JavaBy Athen on February 19, 2009, 8:22 pmHi, That is a good topic, but for another article. Jeff Friesen discusses differences between JavaFX Script and Java code in his article "Jump into JavaFX Script."...
Reply | Read entire comment
View all comments