Perfect ....... thanks!

Wed Sep 20 12:22:58 EDT 2006
Michael Stuhr wrote:
>i think you have to do this manually.
>you either create a cellrenderer for your list and handle it this way (look in 
>the help for 
>cellRenderer API) or you could :
>
>var list:mx.controls.List;
>
>list.addItem({label:"Flash", data:{value:1, enabled:true}} );
>/**/
>list.addItem({label:"Dreamweaver", data:{value:2, enabled:false}} );
>
>list.addItem({label:"ColdFusion", data:{value:3, enabled:true}} );
> >
>function onListClick (evt:Object)
>{
>       var list = evt.target;
>       //
>       if (!list.selectedItem.data.enabled)
>       {
>               list.selectedIndex = undefined;
>               list.invalidate();
>               trace ("this item is disabled")
>       }
>       else
>       {
>               trace ("you selected: " + list.selectedItem.label)
>       }
>}
>function onListRollOver(evt:Object)
>{
>       var list = evt.target;
>var ix = evt.index;
>var item = list.getItemAt(ix);
>var curCol = list.getStyle("backgroundColor"); // be aware of 
>"alternatingRowColors", you'd 
>have to check here if ix is odd or even, also you should check that there's no 
>cutom 
>cellrenderer here
>       //
>       if (!item.data.enabled)
>       {
>               list.setPropertiesAt(ix, {backgroundDisabledColor:curCol});
>               list.invalidate();
>       }
>       else
>       {
>               trace ("you hovered: " + list.selectedItem.label);
>       }
>}
>list.addEventListener ('change', onListClick)
>list.addEventListener ('itemRollOver', onListRollOver)
>
>
>cheers

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to