HI, How do i retreive the total number of items (count) of a combo box in Flex?
A:
Try using:
combobox.collection.length
where combobox
is the combobox you are using
I'm not sure this will work though. You may need to subclass the control because collection is a protected member :(
George Edison
2010-04-15 05:39:15
A:
The dataprovider of combobox is an arraycollection. You can use the length property to count the number.
michael
2010-04-15 06:49:53
Wrong! It's a write-only property.
George Edison
2010-04-15 06:57:48
Maybe, it is not clear. My meaning is the length property of the arraycollection.
michael
2010-04-15 07:58:44
`dataprovider` is a write-only property.
George Edison
2010-04-15 16:13:58
A:
random idea for you:
var dp : Object = combobox.dataProvider ;
if(dp is Array)
{
//do something cool
}
else if(dp is ArrayCollection){
//do something equally as cool
}
etc...
jeremy.mooer
2010-04-15 13:10:59
+1
A:
I've confirmed that this will work:
(comboBox.dataProvider as ArrayCollection).length
houser2112
2010-04-16 12:10:39