Jump to content
  • Advertisement
Sign in to follow this  
eedok

[web] Flex change combo box selection

This topic is 3718 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
This seems like an odd problem. Are you sure the HTTPService has returned the data when you bind it to the comboBox?

Share this post


Link to post
Share on other sites
This seems like an odd problem. Are you sure the HTTPService has returned the data when you bind it to the comboBox?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!