XNSIO
  About   Slides   Home  

 
Managed Chaos
Naresh Jain's Random Thoughts on Software Development and Adventure Sports
     
`
 
RSS Feed
Recent Thoughts
Tags
Recent Comments

ActionScript 3 v/s Java 6 Summary

Here is a quick list of differences I found between AS3 and Java 6 (mostly language syntax and concepts)

  • AS3 places classes inside package blocks. Which allows AS3 to have multiple package definitions per file
  • In AS3 the variable have function scope not block scope
  • AS3 is a mostly type safe language with Dynamic behavior. This means you can add new capabilities (functions and properties) to existing objects at run time.
  • AS3 has metadata while Java has annotations
  • In AS3 semicolons are options if you have one statement per line
  • In AS3 casts look more like a function call through the type being cast or we can use the as operator
  • AS3 does not support generics and typed collections, except it has typed arrays through the Vector class
  • AS3 has E4X integrated into the language to query/manipulation XML
  • In AS3, constructors are always public
  • AS3 does not allow properties on interfaces. Only functions can be declared on interfaces
  • There is no concept of “abstract” in AS3
  • In AS3, because functions are Objects, they can be passed around (like Function Pointers)
  • AS3 has the concept of anonymous functions useful for declaring callbacks or event handlers inline
  • In AS3, the override keyword is required if the subclass declares a function with the same name
  • AS3 does not support Function overloading. Default parameter values might help you achieve it to some extent
  • AS3 has properties as a first-class citizen of the language. get and set keywords are defined as special getters/setters for properties
  • AS3 allows Property access via strings
  • AS3 supports Untyped property access – allows accessing property through the String accessor, even if the property is not present at compile time (you’ll get run-time error)
  • All AS3 objects can act like String maps
  • AS3 supports Untyped variables (mostly type safe language). This allows you to told references without declaring its type
  • AS3 allows Initializing dynamic properties using JSON-like syntax. Create and Initializes the object in one statement

Thanks to Chet Haase for his insightful article on ActionScript for Java developers.


    Licensed under
Creative Commons License