You must derive all visuals, and that means resetting the color if it doesn’t meet the criteria.
On 3/29/10 10:44 AM, "azona26" <azsl1326-em...@yahoo.com> wrote: Thanks. However switching to dataChange event causes all items in the DropDownList to change their text color. --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , Alex Harui <aha...@...> wrote: > > The rules for itemrenderers haven't changed that much. You must still derive > all of your visuals from the data property. Use dataChange instead of > creationComplete. > > > On 3/29/10 9:32 AM, "azona26" <azsl1326-em...@...> wrote: > > > > > > > Here's the code: > > <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" > xmlns:s="library://ns.adobe.com/flex/spark" > xmlns:mx="library://ns.adobe.com/flex/mx" > autoDrawBackground="true" height="20" > creationComplete="itemrenderer_creationCom! pleteHandler(event)"> > <fx:Script> > <![CDATA[ > import com.usa.model.ThumbnailModel; > import com.usa.model.presentation.LightBoxPresenationModel; > import mx.events.FlexEvent; > import mx.utils.StringUtil; > [Inject][Bindable] > public var lightBoxPM:LightBoxPresenationModel; > [Inject][Bindable] > ! public var tnModel:ThumbnailModel; > protected var lightBoxNames_arr:Array > protected function itemrenderer_creationCompleteHandler(event:FlexEvent):void > { > var lbl:String = StringUtil.trimArrayElements(tnModel.d! > ata.asset_lightboxes,",") > lightBoxNames_arr = lbl.split(","); > lightBoxNames_arr.reverse(); > var len:int = lightBoxNames_arr.length > for (var i:int = 0; i < len; i++) { > // i.e. 'Lightbox #1' == 'Lightbox #1' > if( lblDisplay.text == lightBoxNames_arr[i]){ > lblDisplay.setStyle('color','#BBBBBB'); > this.autoDrawBackground = false; > } > } > } > > ]]> > </fx:Script> > <s:Label toolTip="{data.name}" > id="lblDisplay" > top="6" left="2" right="2" bottom="2" > text="{data.name}" /> > </s:ItemRenderer> > > Thanks for the assistance! > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , > Alex Harui <aharui@> wrote: > > > > What does your renderer code look like? > > > > > > On 3/29/10 8:08 AM, "azona26" azsl1326-email@ wrote: > > > > > > > > > > > > > > I have a Spark DropDownList that has a custom ItemRenderer. The > > ItemRenderer, upon creation, checks th! e label text and if it matches > > certain criteria, then the labe! l text c olor changes. The label text > > color is changing, however it is for the wrong label. What appears to be > > happening is that the label color that is actually being changed is in > > reverse order of how the labels are displayed in the drop down list. > > > > For example, the list contains the text labels: One, Two, Three, Four, and > > is being displayed in that exact order. I am checking for the label "One" > > and then changing it's text color. What actually ends up ! happening is > > that the text color for "Four" (first item from bottom) is actually being > > changed. If I check for the text label, "Three", then the text color for > > "Two" (third item from bottom) gets changed. If I check for the label text > > "Four", the text color for "One" (fourth item from bottom) gets changes. > > This functionality seems to hold true for each item in the DropDownList. > > > > Any suggestions on how to resolve this issue so that the correct text color > > is being changed? > > > > Thanks for th! e assistance. > > > > > > > > > > > > -- > > Alex Harui > > Flex SDK Team > > Adobe System, Inc. > > http://blogs.adobe.com/aharui > > > > > > > > -- > Alex Harui > Flex SDK Team > Adobe System, Inc. > http://blogs.adobe.com/aharui > -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui