[an error occurred while processing this directive]

HorizontalList Control with Data Provider

                         

HorizontalList control displays item in a horizontal list. It is very much similar to the List control that you have earlier used in the previous example. HorizontalList control can be useful in the application where we want to arrange items in horizontal direction only but not vertically. 

In our this example we have created an array collection item which consists of the name of the employees and this item list is attached to the HorizontalList control with the dataprovider property of the HorizontalList control.

Here is the full source code of application as follows :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="373" height="272">
  <mx:ArrayCollection id="employeeList">
    <mx:source>
      <mx:Object label="Amit Kumar" data="1001"/>
      <mx:Object label="Sumit Kumar" data="1002"/>
      <mx:Object label="Ranjeet Kumar" data="1003"/>
      <mx:Object label="Sanjeev Kumar" data="1004"/>
      <mx:Object label="Dileep Kumar" data="1005"/>
    </mx:source>     
  </mx:ArrayCollection> 
  <mx:Panel x="10" y="10" width="353" height="252" layout="absolute" title="Horizontal List with Data Provider Example">
    <mx:HorizontalList x="19" y="10" width="262" 
      height="151" 
      dataProvider="{employeeList}" 
      rowCount="1" 
      columnWidth="100"
      color="#FBFBFB" 
      borderColor="#A06565"
      backgroundColor="#FFDFA0"
      backgroundAlpha="0.75">
    
    </mx:HorizontalList>
    <mx:HorizontalList x="19" y="160" width="262" height="21" borderColor="#4B603B" columnCount="1">
      <mx:dataProvider>
        <mx:Object label="Employee List" data="List of Employee"/>
      </mx:dataProvider>
    </mx:HorizontalList>
</mx:Panel>  
</mx:Application>

Output :

Here is the output of the application as follows :

 

Watch in action :

Download Source Code

                         

[an error occurred while processing this directive]