`
peijunlin2008
  • 浏览: 166443 次
  • 性别: Icon_minigender_1
  • 来自: 河北省
社区版块
存档分类
最新评论

每天学一点 Repeater 组件

    博客分类:
  • Flex
阅读更多
mx.core.Repeater 类是对应于 <mx:Repeater> 标签的运行时对象。它根据其 dataProvider 创建其子组件的多个实例。重复的组件可以是任意标准或自定义控件或容器。
您可以在允许使用控件或容器标签(<mx:Application> 容器标签除外)的任何位置使用 <mx:Repeater> 标签。要重复用户界面组件,您需要将其标签放在 <mx:Repeater> 标签中。您可以在 MXML 文档中使用多个 <mx:Repeater> 标签。还可以嵌套 <mx:Repeater> 标签。

不能对不扩展 UIComponent 类的对象使用 <mx:Repeater> 标签。

 <?xml version="1.0" encoding="utf-8"?>
<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    viewSourceURL="src/RepeaterStatic/index.html"
    width="275" height="200"

>
     <mx:Script>
        <![CDATA[
            [Bindable]
            public var myArray:Array=[1,2,3,4];
        ]]>

    </mx:Script>
    
    <mx:Panel 
        title="Repeater: emulating a for loop"
        paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10"

    >
        
        <mx:Repeater id="myRep" dataProvider="{myArray}"> 
            <mx:Label 
                id="myLabel" 
                text="This is loop #{myRep.currentIndex}"

            />
        </mx:Repeater>
  
    </mx:Panel>
</mx:Application>




分享到:
评论
1 楼 peijunlin2008 2010-03-04  
显示数组内容:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">	
	<mx:Script>
		<![CDATA[
		    [Bindable]
			public var myArray:Array = ['a','b','c','d'];
			
		]]>
	</mx:Script>
	
	<mx:Panel title="Repeater:emulation a for loop" width="450" height="339" x="127" y="27">
		<mx:Repeater id="myRep" dataProvider="{myArray}">
			<mx:Label id="myLabel" text="This is loop #{myRep.currentItem}"/>
		</mx:Repeater>
	</mx:Panel>
</mx:Application>


相关推荐

Global site tag (gtag.js) - Google Analytics