Share on Google+Share on Google+

List Control in Flex4

Advertisement
Flex 4 List control is also called a Spark List control which displays a list of data items. The user can select one or more item from the list at a time by using the allowmultipleselection property.

List control in Flex4:

Flex 4 List control is also called a Spark List control which displays a list of data items. The user can select one or more item from the list at a time by using the allowmultipleselection property. If list item do not fit in the List control then horizontal  and vertical scroller occur according to the List Layout. You can use the data provider property (<s:dataprovider>) for providing a data to a List control.
The tag is <s:List>...</s:List>.

Example:

<?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"

xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

<s:Panel title="List Control Example" width="215" height="236" color="#990000">

<s:HGroup x="45" y="15">

<s:List id="lst" allowMultipleSelection="true"

alternatingItemColors="[#66FF00, #33C000]"

rollOverColor="Black"

height="140"

color="white" >

<s:dataProvider>

<mx:ArrayCollection>

<fx:String>C</fx:String>

<fx:String>HTML</fx:String>

<fx:String>CSS</fx:String>

<fx:String>JAVA</fx:String>

<fx:String>PHP</fx:String>

<fx:String>UNIX</fx:String>

<fx:String>FLEX</fx:String>

<fx:String>C++</fx:String>

<fx:String>C#</fx:String>

<fx:String>.NET</fx:String>

<fx:String>CCNA</fx:String>

<fx:String>ORACLE</fx:String>

<fx:String>FLASH</fx:String>

</mx:ArrayCollection>

</s:dataProvider>

</s:List>

</s:HGroup>

</s:Panel>

</s:Application>

Output:


Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Advertisements

Advertisement

Posted on: May 12, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.