Milos Zikic - Personal site, sharing thoughts about startups, products and engineering

Flex ArrayIndexOutOfBounds Exception in SDK 4.1 on incremental builds

There is an ArrayIndexOutOfBounds exception with the latest final build of Flex SDK 4.1 which manifests itself with incremental builds. Hopefully problem is solved!

There is no official full sdk release out there but in order to solve this you should replace mxmlc.jar in libs folder of your existing sdklocation.

Good mxmlc.jar file can be downloaded from:

And the complete Jira issue is at:

Enjoy your incremental builds again :)

(it seams that this occurs when you are using halo and spark components al together only)

Embed fonts in Flex but smartly!

Embeded fonts have so many advantages instead of using system ones. As Adobe stated already over this topic:

  • Client environment does not need the font to be installed.
  • Embedded fonts can be rotated and faded.
  • Embedded fonts are anti-aliased, which means that their edges are smoothed for easier readability. This is especially apparent when the text size is large.
  • Embedded fonts provide smoother playback when zooming.
  • Text appears exactly as you expect when you use embedded fonts.
  • When you embed a font, you can use the advanced anti-aliasing information that provides clear, high-quality text rendering in SWF files. Using advanced anti-aliasing greatly improves the readability of text, particularly when it is rendered at smaller font sizes.

But there are drawbacks as well:

  • Increased application size (longer download time)
  • Problems with combining halo and spark components (halo must use embed-as-cff: false)
  • Increased compile time (more hitting over the keyboard and shouting ccmooon cmooooon :D )

So there must be some way to have both of 2 worlds of embeded vs non-embeded fonts and enjoy the coolness of embeded fonts. And yes, there is. There are some optimizations available like embeding just the range of characters. 

Flex 4 SDK brought us  '''fontswf''' tool to pack your fonts as swf, which I find as a great way to manage application fonts.

fontswf has some good arguments to optimize what you get as an output at the end eg. enter character range to be exported.

Sample command line:
fontswf -u U+0041-U+005A,U+0061-U+007A,U+0030-U+0039,U+0020-U+002F,U+003A-U+0040,U+005B-U+0060,U+007B-U+007E  -a Arial -o arial arial.ttf

More about this tool and command line arguments:

And a bit about ranges (explanation what has been done above):
U 0041-U 005A, /* Upper-Case [A..Z] */
U 0061-U 007A, /* Lower-Case a-z */
U 0030-U 0039, /* Numbers [0..9] */
U 0020-U 002F, /* Punctuation */
U 003A-U 0040, /* Punctuation */
U 005B-U 0060, /* Punctuation */
U 007B-U 007E; /* Punctuation */

Coding in the Cloud

Update (03-17) new Cloud ide is available from the creators of Exo platform

Everyone is speaking that we are in the years of Cloud. Cloud is everywhere. It leverages your infrastructure, it lowers operational costs, it scales whenever and how you need it, it helps you have your data wherever you go... well I will not discuss previously stated but it is definitely time for clouds to offer us something more. To allow us to live completely in the web. And for developers it means having great development tools online.

There is always a question over how useful is this but with the todays trend to have internet connected devices with not so great processing power and trend for collaboration on every step this might have a great potential. It would be great that you can code check over what your team is doing while you're on your tablet device and even contribute if you want.

....and how close are we to there.. well it seams its around the corner but there are still missing parts so this can be really productive.

Here is the list what is available that came to my attention:
And some of this have really cool features like collaborative editing and live chat, language validation and even compilation they still lack a lot of what you get in your favourite IDEs right now. Eg. 

  • support running just JavaScript
  • some have evaluation ability but fail with good editing features. 
  • you cannot add additional libraries to your project
  • there is no way to simulate running web applications
  • etc.. 
So basically what we have now is a syntax highlighting and some evaluation... but there is some cool factor in all this and certainly there would be some interesting updates and newcomers in this area so definitely something to watch. 

If you ask for my favorite at this time, I am setting my eye on Cloud9. They are basing their engine on ACE which is a successor of Mozilla Bespin (or SkyWriter) project so definitely have a good base.

So don't trow out your IDEs ... for now...

Interacting with WSSE Services from Flex

Connecting to WSSE (Web Service Security Environment) from Flex is a rarely met. Recently I had a requirement to implement backend integration using WSSE UsernameToken Profile. 
If you want to know more about WSSE you can look at the official oasis specifications:

I would cover now just the Username token profile which is the biggest chance that you'll met in your environment.
Username token can use PasswordText or PasswordDigest for authentication and PasswordDigest is created like this:

PasswordDigest = Base64 (SHA1 (Nonce + CreationTimestamp + Password)) (UTF8 Encoded)

SHA1 is not available by default in Flex SDK but hopefully there as3corelib is available (thanks Mike). It contain a method that can encode this for us:


And now all we have to do is to assemble proper headers to send to our WSSE service call and here is how:

private function callWS(username:String, pass:String, nonce:String, currentDate:Date):void{


// convert date to UTC time
currentDate = DateUtil.getUTCDate(currentDate);

var base64:Base64Encoder = new Base64Encoder();

nonce = base64.toString();

var passString:String = nonce+df.format(currentDate)+pass;

var passDigest:String = SHA1.hashToBase64(passString);
var securityQName:QName = new QName(SECEXT_NS, "Security");

var xmlContent:XML = xmlns:wsse=""




var securityHeader:SOAPHeader = new SOAPHeader(securityQName,xmlContent);


var obj:Object = new Object();
obj.param1 = value1;

authWS.getOperation("someOperation").arguments = obj;

And web service is declared regularly. Here is the example in mxml:


And thats about it. Take note to use SHA1.hashToBase64(String) method to generate your password digest and be sure to always get the UTC time and thats about it.

Happy integration!

Devoxx 2010 Review

Drago mi je da sam imao priliku da ove godine posetim Devoxx. Kartu za isti je obezbedio lokalni JUG JavaSvet a ostatak troškova je pokrio Gecko Solutions (firma u kojoj radim).
Poseta Devoxxu je bio pun pogodak i korisno je naći se među svim ljudima strogo zagriženih tehnoloških monstruma :)

Reportažu možete pogledati na stranici java sveta. I ako vam se cela ova priča svidi, vidimo se sledeće godine! A obzirom na gužvu za sledeću će biti potrebno mnogo ranije nabaviti karte :(

... hmm this is in Serbian !? Well I am Serbian and it is a local JUG community.. but if you still want to read the Devoxx 2010 Review try the google translation of the article. It gives a very decent output. Great job google!