FlexSDK 3.5 gotcha

ActionScript 3 (which is usually mentioned as Flex technology by Adobe) , still have some weird internal bugs (“gotcha”) .

One of the well-known gotchas is the item removal of an ArrayCollection:

var ac : ArrayCollection = new ArrayCollection(); 

for each (var arrItem : String in ac) {
 if (arrItem.charAt(0)=="g") {

Now, try to print (trace) an item within the loop and you’ll be surprised at that trace statement’s output !

Yeah, the ArrayCollection is not truly keeping proper indexes as iterates through its for each. To bypass this removal gotcha, one solution is to use classical for loop with decremented index :

for (var i : int = ac.length-1; i >= 0; i--) {
 if (ac.source[i].charAt(0) == "g") {

tricky, huh ?

Well, and with FlexSDK 3.5 , the compiler (mxmlc) can produce another annoying bug with dependent comboBoxes (not reproducible in Flex SDK 3.3 or 3.6) :

(to be updated)

About DucQuoc.wordpress.com

A coder, husband and brother...
This entry was posted in Coding, Marketing. Bookmark the permalink.

1 Response to FlexSDK 3.5 gotcha

  1. Pingback: Vietnamese Flash developers | DucQuoc's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s