首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

Flex中Repeater的运用

2012-12-25 
Flex中Repeater的使用??xml version1.0 encodingutf-8?s:WindowedApplication xmlns:fxhttp://

Flex中Repeater的使用

?

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">

<fx:Script>
<![CDATA[
import mx.controls.Alert;

[Bindable]
private var array:Array = ['Hello','World'];

protected function showAlertId_clickHandler(event:MouseEvent):void
{
Alert.show(String(event.currentTarget.getRepeaterItem()) + " pressed","提示信息");
}
]]>
</fx:Script>

<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>

<s:Panel width="75%" height="75%" horizontalCenter="0" title="Repeater Example"
verticalCenter="0">
<s:VGroup left="10" right="10" top="10" bottom="10">
<s:Label width="100%" color="blue"
text="Use the Repeater class to create 9 Button controls in a 3 by 3 Tile container."/>

<mx:Tile width="50%" borderStyle="inset" direction="horizontal" horizontalGap="10"
paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10"
verticalGap="10">
<mx:Repeater id="rp" dataProvider="{array}">
<s:Button id="showAlertId" width="60" height="60"
label="{String(rp.currentItem)}"
click="showAlertId_clickHandler(event)"/>
</mx:Repeater>
</mx:Tile>
</s:VGroup>
</s:Panel>

</s:WindowedApplication>

?

?

热点排行