Flex ComboBox data initialization complete event

I have an XML data bound to a Flex combo box.
I'd like to get notified when the combobox is completely initialized with data and the first item of the combobox is in valid selected state.(so that I can do other needed action automatically assuming the first item is selected upon creation)

        <mx:ComboBox dataProvider="{blogNameAry}" width="100%"

Whenever the selection is changed from the combobox, I get correct notificaiton with valid state of the selection.(onBlogChange). But right after the combobox is created, I cannot get the selected data(in this case the first one with index 0). In above example, onBlogCBInit() is called but the current selection is INVALID(meaning you cannot read the text content of the selected item).

I've tried with even {add, initialized, creationComplete} event, but they all behaves the same. Upon the event trigger, I don't have the valid data for the selected item.

How do I achive this initial selection only once when the combobox is completed?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

valueCommit - Dispatched when values are changed programmatically or by user interaction.
also you could use "addedToStage", this one is better because it happens only once if the control is not removed and readded to the stage
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
This is just a suggestion not sure if this works also but try and let me know the result.

In the creationComplete call a method in that method just call blogCB.open(); followed by a blogCB.close(); then I think u must have the data ready to retrieve and use.

Let me know if there is some kind of jerk or flicker when u do all this. Thank you.

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

shahnwebAuthor Commented:
I have 5 items in the CB, and valueCommit gets called 5 times (only 3 of them reads valid data from index 0)

addedToStage is better. It gets called 2 times and the 2nd one gets valid label from index 0.

creationComplete with open() close() trick does not work.

So far the best way is use addedToStage with label length check( != 0), but why does this get called twice?  Any other suggestion?

can you send me a working code , so I can verify that to you? The problem may be because of the binding ocurring late in the flow, but it all depends on the way you did it. If you can send working code with sample data, I can double check that for you. addedToStage should not be called twice, only once.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shahnwebAuthor Commented:
julianopolito, you are probably right this is timing problem for binding.

When I removed the code from onBlogCBInit() to mx:HTTPService's resultHandler code, I could achieve what I aimed at.  So I solved problem.  

addedToStage still gets called twice before the resultHandler gets called and at the very end of the entire code execution.  I use Flex Builder 2, and it could be a bug?  Are you using Flex 3?

Anyway, I found a solution, and would like to close this and honor your input.
Thank you. I use both Flex 2 and 3. I'll make some tests here to verify what you are saying about the added to stage.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Flex

From novice to tech pro — start learning today.