Phew, I finally found the solution. In my custom control, I needed to
override the set data function and perform updates on the item in
there. I ended up creating an mxml component for the renderer that
looked like this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";>
     <mx:Script>
          <![CDATA[
               import mx.events.FlexEvent;

               override public function set data(value:Object):void {
                    if(value != null)  {
                         super.data = value;
                         itemBullet.source = value.bullet;
                         itemTitle.setStyle('color', value.color);
                     }

                     // Dispatch the dataChange event.
                     dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
                 }
          ]]>
     </mx:Script>

     <mx:Label id="itemTitle" text="{data.title}" />
     <mx:Image id="itemBullet" right="0" y="2"/>
</mx:Canvas>

In the calling application, when an item is selected, a function
updates the data so that the selected row has the 'selected' icon and
color and the non-selected items have the 'non-selected' icon and
color - the change in the data automatically triggers the overridden
set data method (above).

It would be better if I could figure out whether the item was selected
or not within the renderer component thus not needing the nonsense
outside code. This works for now though and it's time for tea :)

Dominic

-- 
Blog it up: http://fusion.dominicwatson.co.uk

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:5282
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37

Reply via email to