Does any one know how it’s possible to get in Flex 4 a value of the second item from Drop Down list, assuming I have 3 items listed there?
E.g.
- 5
- 4
- 9
I need 4
MyLable.text=myDDList.dataProvider.getItemAt(1).toString();
this one doesn’t work
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Without knowing your dataProvider structure; it is impossible to give you a definite answer. This code will give you the object being displayed in the second item of the DropDownList:
Using the default labelField, that object should have a field named label on it which will return your suggested value:
You can even make this slightly more flexible:
If you are using a labelFunction; you’ll have to run your object through the labelFunction procedure.
If you’re using custom objects in your dataProvider, you can use the approach in your own answer if you implement a toString() method in that object which returns the ‘4’ string.