关于flex 4的新数据类型中英文对照

Flex 4 new data type:ArrayList

by Flying 2010.4.15 22:53

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

 

不知大家注意到没有,在Flex 4中的引入了一种新数据类型:ArrayList。它实现了IList接口,底层以Array作为数据源。本质上它是一种轻量级的 ArrayCollection,可以作为数据源绑定到控件上。但与ArrayCollection不同的是,它不能筛选和过滤数组。

看下面实例:

<?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>注意,基于list的Spark控件是不能直接以Array作为数据提供者的,一定要实现IList接口。这也应该是引入ArrayList数据类 型的原因之一。

你可能感兴趣的:(xml,Flex,Adobe)