Useful mxmlc command line options

Options for mxmlc compiler: file specification, output location, source paths, script limits, incremental builds, and loading configurations.

December 10, 2009

Gotcha with ActionScript ‘const’

ActionScript (like JavaScript) lets you access object properties using two different notations. Consider the following class class A { public const CONSTANT:int = 34; } var a:A = new A(); The CONSTANT property of object a can be referred using the following two formats: a.CONSTANT a["CONSTANT"] Since CONSTANT is declared using const, it cannot be assigned a new value later on. So the following code doesn’t compile (as expected): a.CONSTANT = 23; However, the following code compiles and only throws an exception at run-time:...

April 13, 2009

How to swap two integers in a single line of code?

This question was asked during IBM’s interview in our campus in 2005: How would you swap two integers in one statement without using a temporary variable in C/C++? After thinking about it for some time, this is what I got (this is in Java): class Swap { public static void main( String[] args ) { int a, b; a = 46; b = 47; System.out.println( "a = " + a + ", b = " + b ); a = b | ( 0 & (b = a)); System....

January 20, 2008