Wednesday, May 9, 2007

In my application, I was bugging my head for a long time as my Tab Navigator was not getting initialized. Data was getting displayed on the first tab but for the other tabs, it was giving a null object reference error.Interesting part here is that if i navigate through all the tabs of tab navigator and then populate it , error was gone.
Reason being very simple, by default only the first tab is initialized and the others are not created.
By setting the property creationPolicy = all, this issue can be resolved.

I thought writing this point here as it took a lot of my time to figure this simple mistake.

Flex Date Formatter

Recently I was working on Flex Builder 2. I must say that its a fine tool from Adobe. Good Job !!
Formatting dates is a problem everywhere and in flex this issue is handled quite nicely.
I have the following example:


var df:DateFormatter = new DateFormatter;

df.formatString="DD-MMM-YYYY";
var dob:String = 28/11/1985;
dob=df.format(dob);

These lines convert the dates into the desired format.