This does work. Thanks for the solutions!
private function changeStyle(event:Event,action:Object):void{
var vbox:VBox = event.currentTarget as VBox;
if (action=='over'){
vbox.styleName='resultsov'
}
else{
vbox.styleName='results'
}
}
<mx:Repeater id="empResults" horizontalCenter="1" >
<mx:VBox id="resultsBox" verticalGap="2" width="100%"
styleName="results"
mouseOver="changeStyle(event,'over')"
mouseOut="changeStyle(event,'out')"
>
<mx:Label text="Employee Name" />
<mx:Label text="Employee No" />
</mx:VBox>
</mx:Repeater>
Joe James
Work: (562) 658-3670
Tie Line: 8-320-3670
CONFIDENTIALITY STATEMENT - This message and any files or text attached to
it are intended only for the recipients named above, and contain
information that may be confidential or privileged. If you are not an
intended recipient, you must not read, copy, use, or disclose this
communication. Please also notify the sender by replying to this message,
and then delete all copies of it from your system. Thank you.
NOTICE TO RECIPIENT: If you are not the intended recipient of this
e-mail, you are prohibited from sharing, copying, or otherwise using or
disclosing its contents. If you have received this e-mail in error,
please notify the sender immediately by reply e-mail and permanently
delete this e-mail and any attachments without reading, forwarding or
saving them. Thank you.
Doug McCune <[EMAIL PROTECTED]>
Sent by: [email protected]
01/19/2007 10:49 AM
Please respond to
[email protected]
To
[email protected]
cc
Subject
Re: [flexcoders] Change style on repeater item
Without checking this before I write it, wouldn't something like this
work?
private function changeStyle(event:Event):void{
var vbox:VBox = event.currentTarget as VBox;
vbox.setStyle('borderColor',0xfff000);
}
and then in the MXML tag you would have:
<mx:VBox verticalGap="2" width="100%"
styleName="results" mouseOver="changeStyle(event)">
That way you don't have to try to reference the item of a repeater by id.
Seems a little cleaner to me (although I haven't tested to make sure it
works).
Doug
Tracy Spratt wrote:
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" 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>
gifLpogWdYWw1.gif
Description: GIF image
gifGAdiNif95y.gif
Description: GIF image

