[web] Flex change combo box selection

Started by
4 comments, last by Torrente 16 years, 1 month ago
I'm just wondering, say I have a combobox that's dataProvider is an HTTPService of xml like

<users>
  <user>
  <id>1</id>
  <name>eedok</name>
  </user>
  <user>
  <id>2</id>
  <name>testuser</name>
  </user>
  <user>
  <id>3</id>
  <name>testuser2</name>
  </user>
</users>
how do I specify for the combobox to select the user with an id of 2? Thanks
Advertisement
If you know that it'll be the second item, just use comboBox.selectedIndex = 1;

Otherwise, get the object by parsing the XML: Working with E4X

By using something close to the example given, "(id=2)," you can retrieve the object with the given id.
I forgot to mention the return value on the HTTPService is object and not XML so it comes back as an ArrayCollection so when I try do do E4X on it, I get this error: TypeError: Error #1123: Filter operator not supported on type mx.collections.ArrayCollection.

Is there something similar for ArrayCollections?
sorry for the double post, but I figured out how to change the selection by just looping over the ArrayCollection.

Now I'm running into another issue, which I believe is caused by the one request finishing(setting the combobox selection) before a prerequisite request(binding the data to the combobox), is there any way to force a function to wait until another is finished before being triggered?
This seems like an odd problem. Are you sure the HTTPService has returned the data when you bind it to the comboBox?
This seems like an odd problem. Are you sure the HTTPService has returned the data when you bind it to the comboBox?

This topic is closed to new replies.

Advertisement