Creation complete works the first time but the component is displayed when you click on a list, and subsequent selections are not displayed. I am having trouble figuring out which on is the correct event.? Sorry but I am relatively new at this kind of programming. Thanks Dan
--- On Wed, 10/8/08, Tracy Spratt <[EMAIL PROTECTED]> wrote: > From: Tracy Spratt <[EMAIL PROTECTED]> > Subject: RE: [flexcoders] ComboBox in Component won't open to Saved Value > To: flexcoders@yahoogroups.com > Date: Wednesday, October 8, 2008, 11:34 AM > Why are you doing that in the "open" event? Try > "creationComplete" > instead. Or set it directly without the function. Or bind > selectedIndex to a bindable variable. > > Tracy > > > > ________________________________ > > From: flexcoders@yahoogroups.com > [mailto:[EMAIL PROTECTED] On > Behalf Of Dan Pride > Sent: Wednesday, October 08, 2008 10:57 AM > To: flexcoders@yahoogroups.com > Subject: RE: [flexcoders] ComboBox in Component won't > open to Saved > Value > > > > Thanks for the response. I understand what needs to be done > as you > described but I still have one problem. > I tried this before. > > private function openGenderPop(event:Event):void { > genderPop.selectedIndex = 1; > } > > The ComboBox opened to the zero value not the 1. > When I clicked on the box it opened to have the 1 value > preselectect but > did not present upon opening. > > I am referencing it like this and must be missing some kind > of kick > event? > > <mx:ComboBox id="genderPop" > close="closeGenderPop(event)" > open="openGenderPop(event)" > dataProvider="{arrGender}" x="583.5" > y="89" > width="116" /> > > Thanks again. > This board is GREAT ! > Dan Pride > > --- On Wed, 10/8/08, Tracy Spratt <[EMAIL PROTECTED] > <mailto:tspratt%40lariatinc.com> > wrote: > > > From: Tracy Spratt <[EMAIL PROTECTED] > <mailto:tspratt%40lariatinc.com> > > > Subject: RE: [flexcoders] ComboBox in Component > won't open to Saved > Value > > To: flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > > Date: Wednesday, October 8, 2008, 11:05 AM > > ComboBox.selectedItem will only work if you assign a > > *reference to an > > item in the ComboBox dataProvider*. This is rarely > > possible and is not > > in your case. > > > > > > > > What you must do is loop over the items in the > > CobmoBox.dataProvider and > > compare the appropriate property's value to the > value > > you want to match. > > When a match is found, use the loop indes to set the > > ComboBox's > > selectedIndex. This is simple enough to do in a > one-off > > situation. > > > > > > > > If you need this often, then you might want to use an > > extended ComboBox. > > Making a generic one is a bit tricky, because the > Combo Box > > dataProvider > > items can have any properties at all. I have an > example on > > www.cflex.net <http://www.cflex.net/ > <http://www.cflex.net/> > (it > allows you > > to set the data > > field you want to match) and Ben forta has done one > and > > there are > > others. > > > > > > > > Tracy > > > > > > > > ________________________________ > > > > From: flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > > > [mailto:flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> ] On > > Behalf Of Dan Pride > > Sent: Wednesday, October 08, 2008 10:01 AM > > To: flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > > Subject: [flexcoders] ComboBox in Component won't > open > > to Saved Value > > > > > > > > Hi > > I have a ComboBox used as a Popup on a form component. > > It saves fine using the following function > > > > private function closeGenderPop(event:Event):void { > > ComboBox(event.target).selectedItem.label}; > > > > > > I want to have it display the stored value the next > time it > > is opened. > > I tried this but no luck. > > > > private function openGenderPop(event:Event):void { > > genderPop.selectedIndex = 1; > > ComboBox(event.target).selectedItem.label; } > > > > Really appreciate the help > > > > Dan Pride