[an error occurred while processing this directive]

List Control with Data Provider

                         

List is the very basic control to the developers. It displays the data as the vertical list of items. It can be used in several conditions since it can have almost all kind of data( i.e anything from image to text). It is used by the programmer in all application from a small application to large scale application.

In this example we have created a simple List with the dataprovider property. The dataprovider property's value contains the value of  set of data objects. Here we have created data object with the help of ArrayCollection. This array collection "dayList" contains 7 items. Here is the full source code :


<?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="daylist">
      <mx:source>
          <mx:Object label="Mon" data="Monday"/>
          <mx:Object label="Tue" data="Tuesday"/>
          <mx:Object label="Wed" data="Wednesday"/>
          <mx:Object label="Thu" data="Thursday"/>
          <mx:Object label="Fri" data="Friday"/>
          <mx:Object label="Sat" data="Saturday"/>
          <mx:Object label="Sun" data="Sunday"/>
      </mx:source>
  </mx:ArrayCollection> 
  <mx:Panel x="10" y="10" width="353" height="252" layout="absolute" 
        
title="List with Data Provider Example">
    <mx:List x="10" y="10" width="313" height="170" dataProvider="{daylist}" >
    </mx:List>
  </mx:Panel>  
</mx:Application>

Output :

Watch in action :

Download Source Code

                         

[an error occurred while processing this directive]