flex4 List 的简单使用

AbacusListDemo.xml

 1  <? xml version = " 1.0 "  encoding = " utf-8 " ?>
 2  < s:Application xmlns:fx = " http://ns.adobe.com/mxml/2009 "  
 3                 xmlns:s = " library://ns.adobe.com/flex/spark "  
 4                 xmlns:mx = " library://ns.adobe.com/flex/mx "  minWidth = " 955 "  minHeight = " 600 "  xmlns:views = " com.shenmo.views.* " >
 5       < fx:Declarations >
 6           <!--  Place non - visual elements (e.g., services, value objects) here  -->
 7       </ fx:Declarations >
 8       < fx:Script >
 9           <! [CDATA[
10              import com.shenmo.utils.BindablePicture;
11              import mx.collections.ArrayCollection;
12              [Bindable]
13               private  var abacusArrayCollection:ArrayCollection  =   new  ArrayCollection([
14                  {pic:BindablePicture.abacus_left},
15                  {pic:BindablePicture.abacus_00},
16                  {pic:BindablePicture.abacus_00},
17                  {pic:BindablePicture.abacus_bit},
18                  {pic:BindablePicture.abacus_00},
19                  {pic:BindablePicture.abacus_00},
20                  {pic:BindablePicture.abacus_bit},
21                  {pic:BindablePicture.abacus_00},
22                  {pic:BindablePicture.abacus_00},
23                  {pic:BindablePicture.abacus_bit},
24                  {pic:BindablePicture.abacus_00},
25                  {pic:BindablePicture.abacus_00},
26                  {pic:BindablePicture.abacus_bit},
27                  {pic:BindablePicture.abacus_00},
28                  {pic:BindablePicture.abacus_00},
29                  {pic:BindablePicture.abacus_bit},
30                  {pic:BindablePicture.abacus_00},
31                  {pic:BindablePicture.abacus_00},                
32                  {pic:BindablePicture.abacus_right}
33              ]);
34          ]] >
35       </ fx:Script >
36      
37      
38       <!---  算盘  -->
39       < s:List id = " lstAbacus "  horizontalCenter = " 0 "  verticalCenter = " 0 "  borderVisible = " false "  width = " 648 "  dataProvider = " {abacusArrayCollection} " >  
40           < s:layout >
41               < s:HorizontalLayout gap = " 0 "  requestedColumnCount = " 17 " />
42           </ s:layout >
43           < s:itemRenderer >
44               < fx:Component >
45                   < views:AbacusItemRender  />
46               </ fx:Component >
47           </ s:itemRenderer >
48       </ s:List >
49  </ s:Application >
50 

注:abacusArrayCollection 的pic值是图片地址

 

 AbacusItemRender.mxml

 1  <? xml version = " 1.0 "  encoding = " utf-8 " ?>
 2  < s:ItemRenderer xmlns:fx = " http://ns.adobe.com/mxml/2009 "  
 3                  xmlns:s = " library://ns.adobe.com/flex/spark "  
 4                  xmlns:mx = " library://ns.adobe.com/flex/mx "   autoDrawBackground = " false "    >     
 5       < fx:Declarations >
 6           <!--  Place non - visual elements (e.g., services, value objects) here  -->
 7       </ fx:Declarations >
 8       < s:layout >
 9           < s:HorizontalLayout gap = " 0 "   />
10       </ s:layout >
11       < mx:Image source = " {data.pic} "   />     
12  </ s:ItemRenderer >
13 


 效果:

 

转载于:https://www.cnblogs.com/sange/archive/2010/09/03/1817316.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值