Wednesday, May 9, 2007

Flex 2: Tab Navigator initialization

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.

33 comments:

Anonymous said...

Hi Rahul,

Welcome to the world of blogging :)

Anonymous said...

Nice job! I was stressing over the same issue. Thanks for posting!

Anonymous said...

Thanx, exactly what I needed. In Flex 2.01, however, you set to creationPolicy to "all". You also have to set it for any children on the tab/viewstack (i.e. embedded panel, etc.).

Anonymous said...

Thanks...I've been using Flex for 2 weeks now..and the TAB issues just poped up yesterday...I thought I was going to have to instantiant each object on tab before I could reference them...THANK YOU

Anonymous said...

thanks a lot man...

Anonymous said...

Hi Raul,

Great Job! Thanks for the hint!
craetionPolicy = "all"; for the Flex 3 ;)

Anonymous said...

Great! just about to start a painful debugging session to solve this problem, helped a lot (Flex 3)

Anonymous said...

Bless You....
That was driving me crazy.
I didn't see anywhere in the
Flex3 doc's where it say's only
the first tab is initialized.

Anonymous said...

Thanks a lot!

Anonymous said...

You saved me probably hours. How should one know that.

Stefan

Anonymous said...

for days that has been annoying me. top man.

Anonymous said...

Thank you so much. This saves me some major headaches.

Anonymous said...

Hurrah!! Thanks.

Unknown said...

A small thing but It's been bothering me for days.

Thanks for posting

Jim said...

How sweet it is. It does this in certain situations in Flex 3 as well. I thought I was going to have to recode the universe. Yikes! Thank you.

tst said...

Thanx :)

Anonymous said...

Thanks! I've been trying to figure this out for a a couple days now. Thanks again! =)

Fica said...

Same problem here. Thanks for help

Anonymous said...

thx!

Anonymous said...

Wished I would have thought about searching for issues with the tabnavigator sooner.... after wasting several hours and even trying to rebuild my app from scratch, came across your post - definitely thankful!

XTOF said...

Thanks dude, I was searching for this :d

greetz xtof

Anonymous said...

Wow, very thanks, it helps me alot :-)

Anonymous said...

Wow man.. saved me bunch of time, tnx !

Anonymous said...

Thank's a lot. Waste of time trying to nd why components are not available...

Anonymous said...

thanks you so much for that little very needed piece of data

Anonymous said...

Thanks for that! You really made my day!

Anonymous said...

Moltes GrĂ cies!! thanks, I was pleased the day

allyouracid said...

Thanks. I stumbled upon this issue being posted by others once in a while (when researching for different problems than that, hehe), so when i got into that issue right now, i remembered that subcomponents of tabs other than the first aren't created yet.

So, luckily i found a quick solution. Thanks. :)

Anonymous said...

Thanks, exactly what I needed. You saved my time. once again thanks...

Anonymous said...

Fanstastic! I was facing the same issue..
Thanks for your help!

Anonymous said...

Thanks for your tip! Fantastic!!!

Anonymous said...

Thanks for the advice! This little code of property works fine and solve my problem about setting the tabs!

sandy said...

thanx a lot. U r a savior :-)