RepeaterExample.mxml
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Repeater class. -->
<s:Application name="RepeaterExample"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">RepeaterExample.mxml
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Repeater class. -->
<s:Application name="RepeaterExample"
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 dp:Array = ["asd", "aszx", "cvd","sdsd", "asdw","qwe"];
private function showAlert(evt:MouseEvent):void {
Alert.show(String(evt.currentTarget.getRepeaterItem()) + " pressed");
}
]]>
</fx:Script>
<s:Panel title="Repeater Example"
width="75%" height="75%"
horizontalCenter="0" 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 direction="horizontal" borderStyle="inset"
horizontalGap="10" verticalGap="15"
paddingLeft="10" paddingTop="10" paddingBottom="10" paddingRight="10">
<mx:Repeater id="rp" dataProvider="{dp}">
<s:Button height="49" width="50"
label="{String(rp.currentItem)}"
click="showAlert(event);"/>
</mx:Repeater>
</mx:Tile>
</s:VGroup>
</s:Panel>
</s:Application>