Thanks valdhor - great solution! I had got this far but was using a textInput and its background color, and even though I had
editable=false;
enabled=false;
the cursor would go into the row. Not good. Question: I had to modify to
g.beginFill(0xE8E8E3, 0.5);
otherwise the line highlight would not show through and could not tell what line was highlighted. It surprised me that a renderer was capable of doing this.
Thanks again,
Mic.
--- In
flexcoders@..., "valdhor" <valdhorlists@...> wrote:
>
> Try the following as a starting point...
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
> layout="absolute">
> <mx:ComboBox itemRenderer="MyLabel">
> <mx:dataProvider>
> <mx:String>*United States</mx:String>
> <mx:String>Australia</mx:String>
> <mx:String>England</mx:String>
> <mx:String>*Ireland</mx:String>
> <mx:String>*Scotland</mx:String>
> <mx:String>Wales</mx:String>
> </mx:dataProvider>
> </mx:ComboBox>
> </mx:Application>
>
> MyLabel.as:
> package
> {
> import flash.display.Graphics;
> import mx.controls.Label;
>
> public class MyLabel extends Label
> {
> public function MyLabel()
> {
> super();
> }
>
> override public function set data(value:Object):void
> {
> if(value != null)
> {
> super.data = value;
> text = value as String;
> }
> }
>
> override protected function
> updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
> {
> super.updateDisplayList(unscaledWidth, unscaledHeight);
> var g:Graphics = graphics;
> g.clear();
> if(text.substr(0,1) == "*")
> {
> g.beginFill(0xE8E8E3);
> }
> else
> {
> g.beginFill(0xFFFFFF);
> }
> g.drawRect(-2, -2, unscaledWidth + 4, unscaledHeight + 4);
> g.endFill();
> }
> }
> }
>
>
>
>
> --- In
flexcoders@..., "Mic" <chigwell23@> wrote:
> >
> > I thought this might work --- fine until I start scrolling when it
> gets totally out of wack. The trace does fire occasionally while
> scrolling but not consistently. Appreciate some hints. TIA,
> >
> > Mic.
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:VBox xmlns:mx="
http://www.adobe.com/2006/mxml"
> horizontalScrollPolicy="off">
> > <mx:Script>
> > <![CDATA[
> > private function labelComplete():void{
> > trace("Here");
> > if(label1.text.substr(0,1) == "*"){
> > this.setStyle("backgroundColor", 0xe8e8e3);
> > }else{
> > this.setStyle("backgroundColor", 0xFFFFFF);
> > }
> > }
> > ]]>
> > </mx:Script>
> > <mx:Label id="label1" text="{data.cmplx_nm}"
> creationComplete="labelComplete()" />
> > </mx:VBox>
> >
>