List和Repeator的使用

<?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:Script>
    
        <![CDATA[
            import mx.collections.ArrayCollection;
            [Bindable]
            private var d:ArrayCollection=new ArrayCollection([
                {label:"aa"},{label:"bb"},{label:"cc"},{label:"aa"},{label:"bb"},{label:"cc"},{label:"aa"},{label:"bb"},{label:"cc"},{label:"dd"}
            ]);
        ]]>
    </fx:Script>
    <fx:Declarations>
        <!-- 将非可视元素(例如服务、值对象)放在此处 -->
    </fx:Declarations>
    <s:List x="200" y="100" width="200" height="100" dataProvider="{d}"></s:List>
    <mx:VBox width="200" height="200" >
        <mx:Repeater dataProvider="{d}" id="rp">
            <s:Button width="50" label="{rp.currentItem.label}"/>
        </mx:Repeater>
    </mx:VBox>
</s:Application>

 

posted on 2012-09-10 17:32  雷、  阅读(227)  评论(0)    收藏  举报

导航