Sorry for the delayed response, I was on vacation.  It's possible that
when we deserialized certain numbers became numbers which they aren't in
XML?  If you don't have an example it may be something where you need to
spend some time in the debugger examining the differences in the
structures... 

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Jamie O
Sent: Monday, November 20, 2006 7:30 AM
To: [email protected]
Subject: [flexcoders] Re: Manipulating ComboBox.selectedItem issues

 

I do have all the matching data to build an exact copy of the street
object when the pop-up is being displayed, yet when I evaluate in the
parseXML function (via an if statement) it does not fire the expected
conditions. I did the same comparison on the last newStreet value (for
a particular case where there is only one street in the XML) and the
cmbStreet.selectedItem = newStreet does work.

Is there anything unique about building an object via XML source
versus individual strings of data that would lead to the data based
version to not == xml based version?

Unfortunately not something I can post all of the source code for to
have an easier time of debug / others comprehending the question.

Thx,
Jamie

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Matt Chotin" <[EMAIL PROTECTED]> wrote:
>
> If you don't have an actual copy of the object that would be == to the
> selectedItem you want to set in the combobox, you'll need to iterate
> through all the entries in the 2nd combo and see if the values of its
> properties match the one you want to set. So if that's a combination
of
> multiple properties you'll need to compare all of those properties.
> 
> 
> 
> Hope I'm understanding your problem correctly,
> 
> Matt 
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Jamie O
> Sent: Thursday, November 16, 2006 10:53 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Manipulating ComboBox.selectedItem issues
> 
> 
> 
> I have two combo boxes listening to array collections for their data
> providers. When the user selects one entry in the first combo box, the
> eventHandler on first combo box change() event will drive what data
> should be populated into the array collection for the other combo box.
> That part all works fine, code snippets are below.
> 
> Everything I've managed to find on using ComboBox.selectedItem has
> been a .data or .label or LabelFunction sample and simplistic. What
> happens when you have multiple data elements within the entry of an AC
> which is dataprovider for a combobox? How come the labelFunction can
> return the unique element but I can't access those unique elements for
> selectedItem?
> 
> <mx:ComboBox id="cmbNumber" width="100" left="10" top="15"
> prompt="Select" change="PrepareAddress()"
> dataProvider="{Content.acStreetNumbers}"/>
> 
> <mx:ComboBox id="cmbStreet" width="200" left="118" top="15"
> prompt="Select" labelFunction="drawStreet" change="StreetHandler()"
> dataProvider="{Content.acStreetNames}"/>
> 
> private function StreetHandler():void {
> Content.acStreetNumbers.removeAll();
> 
> for each (var numberRangeXML:XML in SourceXML.Street.(@Name ==
> cmbStreet.selectedItem.streetname).NumberRange) {
> var i:int;
> for (i = int([EMAIL PROTECTED]); i <= int([EMAIL PROTECTED]); i =
> i + 1) {
> Content.acStreetNumbers.addItem(i);
> }
> }
> }
> 
> Here's the loop I use to populate the Content.acStreetNames array:
> for each (var streetXML:XML in SourceXML.Street) {
> var newStreet:Object = new Object();
> newStreet.streetlabel = [EMAIL PROTECTED] + " " + [EMAIL PROTECTED] + " "
> + [EMAIL PROTECTED];
> newStreet.streetname = [EMAIL PROTECTED]
> <mailto:streetXML.%40Name.toString> ();
> newStreet.streettype = [EMAIL PROTECTED]
> <mailto:streetXML.%40Type.toString> ();
> newStreet.streetdir = [EMAIL PROTECTED]
> <mailto:streetXML.%40Direction.toString> ();
> Content.acStreetNames.addItem(newStreet);
> }
> 
> My labelFunction 'drawStreet' picks up the streetlabel variable just
> fine. The issue I have is that in another use case for this component,
> I want to pre-populate what is displayed in the fields. I can make
> cmbStreet.text and cmbNumber.text include the data, but that's a hack
> because it isn't truly driven on the underlying data. As a result if
> you look into the drop-down for cmbNumber you won't see any entries.
> 
> cmbStreet.selectedLabel is read-only so can't be modified for my use.
> 
> Modifying cmbStreet.selectedItem with data I know is in the underlying
> AC does not seem to trigger the effect.
> 
> Modifying cmbStreet.selectedItem.streetname - what I would have
> expected to work - gets me a "Error #1009: Cannot access a property or
> method of a null object reference." on execution.
> 
> Even building an entire object to use against selectedItem doesn't
work.
>

 

Reply via email to