I am so happy I was able to create an itemRenderer with an initialize event that dynamically set the style for each item based on the source data. This worked flawlessly for one HorizontalList ( List A) so I tried to implement the same on a TileList (List B) on the same layout. They have virtually the same dataProvider - List B items are originally drag/dropped to List A.
These list are nearly identical in every way yet when the event fires for the itemRenderer in List B it fails with "null object" error. It seems that the data is not available when the event dispatches. I am at a loss as to why it works for one list and not the other. The data used by the event is not null when it renders since all the items (data) are accounted for. here my itemRenderer code that works - <?xml version="1.0" encoding="utf-8"?> <!-- itemRenderers\navScreenRender.mxml --> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="200" height="200" horizontalScrollPolicy="off" verticalScrollPolicy="off" borderStyle="solid" backgroundImage="assets/images/{data.imageID}" alpha="1.0" backgroundAlpha="1.0" borderColor="#333333"> <mx:Script> <![CDATA[ private function setContentButton(event:Event,V):void{ var e = event.currentTarget if(V==''){ e.styleName = 'customcontentbuttonOff' e.alpha = 1.0 e.toolTip = "Content Editor is not enabled for this screen - click to complete the setup" } else if(V!="(preset)"){ e.styleName = 'customcontentbuttonOn' e.alpha = 1.0 e.toolTip = "Content Editor is enabled for this screen - click to change the setup" } else if(V=="(preset)"){ e.alpha = 0.0 } } ]]> </mx:Script> <mx:Text id="layoutLabel" text = "{data.label}" fontSize="8" color="#ffffff" textAlign="center" letterSpacing="0" horizontalCenter="0" verticalCenter="-38"/> <mx:Image source = "assets/images/{data.imageID}" toolTip="{data.description}" scaleContent="false" alpha="1" visible="false"/> <mx:Button label="{data.displaySeq-0+1}" width="25" height="20" cornerRadius="12" styleName="adminbutton" fontWeight="bold" fontSize="9" verticalCenter="20" horizontalCenter="0"/> <mx:Button id="contentButton" initialize="{setContentButton(event,data.contentLocation)}" label="C" width="18" height="18" cornerRadius="12" styleName="customcontentbuttonOff" fontWeight="bold" fontSize="10" verticalCenter="-1" horizontalCenter="0" alpha="1.0"/> </mx:Canvas>