Link to home
Start Free TrialLog in
Avatar of _CODER_
_CODER_

asked on

Conditional Statement in Repeater Control

Can someone post an example of embedding a conditional statement in a repeater? For example in the sample below if the currentItem is 3 change the button color to blue.



<?xml version="1.0"?>
<!-- Simple example to demonstrate the Repeater class. -->
<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" id="Button1"
label="{String(rp.currentItem)}"
click="Alert.show(String(event.currentTarget.getRepeaterItem()) + ' pressed')"/>
</mx:Repeater> 
</mx:Tile>
 
</mx:Panel> 
</mx:Application>

Open in new window

Avatar of _CODER_
_CODER_

ASKER

bumping up the points... Just need an example please.
Avatar of _CODER_

ASKER

raising points again... anyone?
ASKER CERTIFIED SOLUTION
Avatar of Gary Benade
Gary Benade
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of _CODER_

ASKER

Thank you!