I am recommending that you modify your renderer in Actionscript instead
of MXML. It will be much more efficient, and you can use
ListItemRenderer as a template, and borrow background modification code
from the examples on my blog for DataGridItemRenderer (which is a
TextField).
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of djohnson29
Sent: Monday, July 21, 2008 2:41 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: TextArea - changing backgroundColor on
MouseOver when used in an ItemRenderer
Thanks for the reply Alex - Most of the examples I see are using the
DataGrid and working with the DataGridItemRenderer. Do you have any
specific examples using ListItemRenderer and a List? I have been
googling modifying ListItemRenderer but can't seem to see any
examples. The only examples I can seem to find with List use the
mx:itemRenderer tag with child components laid out in the same way
that I have in my code.
It's not clear to me what exactly I would need to modify in
ListItemRenderer. And if the ListItemRenderer uses TextFields which
are more efficient, how would I specify these in the mxml? Also, how
would I be able to specify the Image that I need? Currently the mxml
looks like this:
mx:itemRenderer
mx:Component
mx:Label ...
mx:Image ...
etc...
I am fairly inexperienced with modifying / overriding existing Flex
components so I apologize if these questions seem a bit redundant.
Thanks
--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Alex Harui [EMAIL PROTECTED] wrote:
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:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] On
Behalf Of djohnson29
Sent: Friday, July 18, 2008 1:06 PM
To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.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.