Title: Mercury Email Signature
Shlomi,
 
One possibility is that you are setting the index of the combobox before the databinding fires.  Thus:
 
1.  It attempts to set the index to 2.
2.  It sees the dataprovider has length 0.
3.  It silently fails at runtime.
 
some time goes by
 
4.  The dataprovider is populated by databinding.
 
You might want to try this:
 
    private function getMySelectedIndex(intervals:Object):Number
    {
   
        return(2);
 
    }
 
 
 
<mx:ComboBox id="intervalCMB" dataProvider="{intervals}" selectedIndex="{getMySelectedIndex(intervals)}"/>
 
When 'intervals' changes it fires off a call to the local function getMySelectedIndex via databinding.
 
 
HTH,
Allen
 
Allen Manning, Technical Director
Prismix Ltd t: +44 (0)870 749 1100 f: +44 (0)870 749 1200 w: www.prismix.com
 
 
 
 
 
 
 
 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Sreejith Unnikrishnan
Sent: 17 May 2005 14:34
To: [email protected]
Subject: Re: [flexcoders] combobox selectedIndex

Shlomi,

There's nothing wrong with the code that you have posted below.
Only reason why I think this would not work is if you have only 2 items in the ComboBox!

If not, try this as well
<mx:ComboBox id="intervalCMB" dataProvider="{intervals}" initialize="intervalCMB.selectedIndex="2" />

Sree

Shlomi Cohen wrote:
 
Hi
 
Does anyone know how to set an initial selected index on a Combo (for edit dialog for example)
 
i have tried this code and it doesn't work .

<mx:ComboBox id="intervalCMB" dataProvider="{intervals}" selectedIndex="2" />

thanks
 
Shlomi

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________


Yahoo! Groups Links

Reply via email to