<?xml version="1.0"?>
<!-- Simple example to demonstrate the Repeater class. -->
<!--
如何使用Flex Repeater
MyShareBook.cn 翻译
-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
[Bindable]
private var dp:Array = [1, 2, 3, 4, 5, 6, 7, 8, 9];
]]>
</mx:Script>
<mx:Panel title="Repeater Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<mx:Text width="100%" color="blue"
text="Use the Repeater class to create 9 Button controls in a 3 by 3 Tile container."/>
<mx:Tile direction="horizontal" borderStyle="inset"
horizontalGap="10" verticalGap="15"
paddingLeft="10" paddingTop="10" paddingBottom="10" paddingRight="10">
<mx:Repeater id="rp" dataProvider="{dp}">
<mx:Button height="49" width="50"
label="{String(rp.currentItem)}"
click="Alert.show(String(event.currentTarget.getRepeaterItem()) + ' pressed')"/>
</mx:Repeater>
</mx:Tile>
</mx:Panel>
</mx:Application>
如何使用Flex Repeater
最新推荐文章于 2014-02-20 18:35:40 发布
本文介绍了一个使用 Flex Repeater 类创建 3x3 布局的按钮实例。通过绑定数据源 dp 数组到 Repeater 控件,实现了按钮的动态生成,并为每个按钮设置了点击事件,当按钮被点击时弹出提示框显示该按钮对应的值。
211

被折叠的 条评论
为什么被折叠?



