I'd copy and modify the code from ListItemRenderer and not use
Canvas/Label/TextArea.  It uses textFields which you can more easily
control backgrounds and your renderer will be much smaller and faster.
You can see some of the ways I do this on my blog
(blogs.adobe.com/aharui).

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of djohnson29
Sent: Friday, July 18, 2008 1:06 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: TextArea - changing backgroundColor on
MouseOver when used in an ItemRenderer

 

Arghgh...sorry folks - posted my question before finishing it...

My question is: How can I change the backgroundColor of a TextArea
that is used within an itemRenderer when the MouseOver event fires?

I have the following code:

<mx:List id="lstPeople" dataProvider="{people.person}" 
width="250" height="160" >
<mx:itemRenderer >
<mx:Component>
<mx:Canvas width="240" height="75"> 
<mx:Label left="50" top="3" text="{data.Name}"/>
<mx:TextArea id="taAddress" left="50" top="21"
text="{data.Address}" editable="false" 
borderStyle="none" /> 
<mx:Image source="assets/person.png" left="10" top="3"/>
</mx:Canvas> 
</mx:Component> 
</mx:itemRenderer> 
</mx:List>

When the user hovers the mouse over the List, the default behaviour is
to highlight the background color of each cell in the List. Since I
am using a TextArea, the background of this particular control stays
white and stands out.

The TextArea component has a backgroundColor property and a MouseOver
event, so I figured that I could call an function from within the
MouseOver event to set the TextArea's background color.

I have been unsuccessful - I can't get a reference to the textArea,
even though it has an ID, and if I try to call the function inline
from the mouseOver event in the TextArea's mxml, I get a compiler area.

Thanks.

 

Reply via email to