Apr
15
2010

Flex 4 new data type:ArrayList

There is a new data type: ArrayLis, I wonder if you have known it or not. ArrayList implements IList interface and use Array as its source of the data. Essentially it is a lightweight ArrayCollection, and can be used as source of the data to bind to the control. ArrayCollection can apply sort and filter, but ArrayList can't.

See the following examples:

<?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">
	<fx:Declarations>
		<s:ArrayList id="al">
			<fx:Object type="Line" class="LineSeries"/>
			<fx:Object type="Mountain" class="AreaSeries"/>
			<fx:Object type="Candlestick" class="CandlestickSeries"/>
			<fx:Object type="HLOC" class="HLOCSeries"/>
		</s:ArrayList>
	</fx:Declarations>
	<s:DropDownList dataProvider="{al}" 
		labelField="type" selectedIndex="0"/>
</s:Application>

Note that the list based Spark controls can't directly use Array as it's dataProvider, the dataProvider must implement IList interface, which should be one of the reasons to introduce ArrayList.

原文:http://www.riafan.com/article/flex/arraylist.html

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading