Thanks again guys, I am however, tearing my hair out over a different
issue with the renderer (yeh they are dead simple :)
My renderer is very simple and I write it inline with my mx:List control:
<mx:List ...>
<mx:itemRenderer>
<mx:Component>
<mx:Canvas>
<mx:Label id="title" text="{data.title}" />
<mx:Image id="itemBullet" source="{data.bullet}"
right="0" y="2"/>
</mx:Canvas>
</mx:Component>
</mx:itemRenderer>
</mx:List>
This all works lovely with the exception that I can't set the color of
the label when an item is selected. Without the renderer I just used
the selectedTextColor property of the mx:List control but that does
not carry over to the custom renderer. I have tried:
<mx:Label id="title" text="{data.title}" color="{data.color}" />
And when an item is selected I update color properties for each
dataCollection item based on whether it is selected or not - no joy
(doing this works for the image btw - I only display an image for the
selected item).
Any ideas?
Dominic
2008/6/2 Simon Bailey <[EMAIL PROTECTED]>:
> I found this link awesome for custom list renderers!
>
> http://www.arpitonline.com/blog/?p=107
>
> Dan, I found the same thing, pulled my hair out on that one for a hot
> second http://www.nutrixinteractive.com/blog/?p=56
>
> Cheers
>
> Simon
>
> On 2 Jun 2008, at 16:36, Dan Vega wrote:
>
>> Item Renderers are pretty easy and they give you full control of the
>> layout.
>> One issue I had and I am sure you will run into at some point is
>> accessing
>> other ui components or methods from within the item renderer. There
>> is a
>> special static variable called outerDocument when using a component.
>> In my
>> example there is a drop down combo box that contains the selected
>> album, to
>> get the value I wrote a quick function but without the outerDocument
>> you are
>> unable to access the methods because they are out of scope. Hope
>> this helps.
>>
>> <mx:TileList id="tlPhotos" dataProvider="{_photos}" width="800"
>> height="500" itemClick="onItemClick(event)">
>> <mx:itemRenderer>
>> <mx:Component>
>> <mx:VBox horizontalScrollPolicy="off"
>> verticalScrollPolicy="off" width="125" height="125"
>> horizontalAlign="center">
>> <mx:Image
>> source="albums/{outerDocument.getSelectedAlbum()}/{data.Name}"
>> width="100"
>> height="100" buttonMode="true"/>
>> </mx:VBox>
>> </mx:Component>
>> </mx:itemRenderer>
>> </mx:TileList>
>>
>>
>> On Mon, Jun 2, 2008 at 11:30 AM, Stefan Richter <[EMAIL PROTECTED]
>> >
>> wrote:
>>
>>> yes an itemrenderer will definitely do it - and they are quite easy
>>> to
>>> do in Flex.
>>>
>>>
>>> Cheers
>>>
>>> Stefan
>>>
>>>
>>>
>>> On 2 Jun 2008, at 15:57, Dominic Watson wrote:
>>>
>>>>> I am still pretty new so I am not sure if there is a way to do
>>>>> that. I do
>>>>> know that you can create your own Item Renderer though that would
>>>>> have the
>>>>> text first and then an icon.
>>>>>
>>>>> Dan
>>>>
>>>> Thanks dan, was hoping to avoid that learning curve (started Flex on
>>>> Saturday night) but I guess its time to get stuck in there!
>>>>
>>>> I must say though, I have a fully working slideshow presentation app
>>>> that takes an external xml file for its slide content configuration
>>>> - playing videos & sound clips much like cfpresentation, and
>>>> developed in a weekend starting at zero Flex knowledge = Flex & Flex
>>>> Builder are awesome!
>>>>
>>>>
>>>
>>>
>>
>>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:5278
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37