Is there a list box in Flex 4.6?
If yes,can sm1 tel me how to implement a list box in Flex code
Thanks
Is there a list box in Flex 4.6?
If yes,can sm1 tel me how to implement a list box in Flex code
Thanks
Flex has a Spark List control, using an IList
(ArrayList
or ArrayCollection
) as the data provider.
Declarative approach:
Using MXML, this is implemented as <s:List>
, as in:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:List>
<s:dataProvider>
<s:ArrayList>
<fx:String>Item 1</fx:String>
<fx:String>Item 2</fx:String>
<fx:String>Item 3</fx:String>
</s:ArrayList>
</s:dataProvider>
</s:List>
</s:Application>
Programmatic approach:
From code, a list is instantiated and added to the display list such as:
import mx.collections.ArrayList;
import spark.components.List;
var list:List = new List();
list.dataProvider = new ArrayList([ "Item 1", "Item 2", "Item 3" ]);
addElement(list);
References: