Thanks Alex, much appreciated!

This is how it turned out, testing well!

-Greg

//CreationComplete handler
private function initRenderer():void
{

    //Must listen for both CHANGE and DATA_CHANGE events
    this.outerList.addEventListener(ListEvent.CHANGE, checkSelected);
    this.addEventListener(FlexEvent.DATA_CHANGE, checkSelected);
}


private function checkSelected(event:Event = null)
{
    if( isItemSelected())
        //do some custom styling
    else
        //do some custom styling
}


private function isItemSelected():Boolean
{
    var sel:Boolean = false;

    //First just check if we are the selected item
    //if so we know our item has just been selected
    if(this.outerList.selectedItem == this.data)
        sel = true;
    else
    {
        //To support multiselections we need to also check the list
        //of selected items
         for( var i:int = 0; i < this.outerList.selectedItems.length
&& !sel; ++i)
         {
            sel = (this.outerList.selectedItems[i] == this.data);
         }
    }

    return sel;
}


On Wed, Jun 18, 2008 at 1:54 AM, Alex Harui <[EMAIL PROTECTED]> wrote:
>
> Unless there are focusable objects, they won't get focus.  I think you want 
> to catch the "change" even tinstead?
>
>
>
> ________________________________
>
> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Greg 
> Hess
> Sent: Monday, June 16, 2008 7:27 AM
> To: [email protected]
> Subject: [flexcoders] How to catch Focus In/Out event on TileList ItemRenderer
>
>
>
> Hi All,
>
>
>
> I have a TileList employing a custom ItemRenderer (VBox with Image and 
> labels). I would like to catch Focus In/Out on the ItemRenderer so that when 
> selected I can change the border style on the VBox to provide a custom select 
> indicator instead of the default provide by the TileList (changing the 
> background of the entire cell). I have not yet been able to catch the Focus 
> Event on this ItemRenderer my code is as follows:
>
> <mx:VBox
>
> xmlns:mx="http://www.adobe.com/2006/mxml"; mouseFocusEnabled="true" 
> focusEnabled="true" mouseEnabled="true" 
> mouseFocusChange="onMouseFocusChange(event)" >
>
> The onMouseFocusChangeEvent is never fired. I also tried adding an 
> eventListener on creationComplete method with not success.
>
> How can I do this?
>
> Any help much appreciated.
>
> Thanks,
>
> Greg
>
>
>
> 

    this.outerList = (this.parentDocument).thumbnailView;

Reply via email to