You need to refer to the individual repeater elements using the id
array:

resultsBox[n].setStyle('borderColor',0xfff000);

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Joe
Sent: Friday, January 19, 2007 12:55 PM
To: [email protected]
Subject: [flexcoders] Change style on repeater item

 

I am having a hard time changing the style of an item inside of a 
repeater. I can not seem to communicate to it. setStyle does not seem 
to work either. Is there syntax that I am missing to communicate to 
something inside a repeater?

<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " width="100%" 
height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" 
horizontalCenter="1">

<mx:Script>
<![CDATA[


private function changeStyle():void{

resultsBox.setStyle('borderColor',0xfff000);
}

]]>
</mx:Script>

<mx:Style>


.results {backgroundColor:#ffffff;
borderStyle:solid;
borderColor:#dcdcdc;
borderThickness:1;
padding-bottom:5;
padding-top:5;
padding-right:5;
padding-left:5;
cornerRadius: 6;}

.resultsov {backgroundColor:#ffffff;
borderStyle:solid;
borderColor:#fff000;
borderThickness:2;
padding-bottom:5;
padding-top:5;
padding-right:5;
padding-left:5;}


</mx:Style>

<mx:Tile id="empTile" styleName="results" width="100%" 
height="100%" paddingLeft="5" paddingRight="5" paddingTop="5" 
paddingBottom="5"
verticalGap="5" horizontalScrollPolicy="off" 
horizontalAlign="center" horizontalCenter="1">

<mx:Repeater id="empResults" horizontalCenter="1" >
<mx:VBox id="resultsBox" verticalGap="2" width="100%" 
styleName="results" mouseOver="changeStyle()">
<mx:Label text="Employee Name : " fontWeight="bold"/>
<mx:Label text="Employee No : " />
</mx:VBox>
</mx:Repeater> 

</mx:Tile>

</mx:Canvas>

 

Reply via email to