A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: ComboBox values color change based on "if" condition

  1. #1
    Senior Member
    Join Date
    Jun 2009

    Thumbs up ComboBox values color change based on "if" condition

    hello friends,

    I need a small help from you guys. I am doing a simple combobox example. Now my requirement was, i want to differentiate the combobox values with some colors based on a condition.

    Suppose for ex: if my combobox data value exceeds 200 i want to display the items in "red" else i want to display in "green". i need solutions for this requirment.

    your help would be appreciated. i need it asap. kindly refer the attached image, that is what i am looking for. my output should look like that.


    <?xml version="1.0" encoding="utf-8"?>
    <!-- Simple example to demonstrate the Halo ComboBox control. -->
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

    import mx.collections.ArrayCollection;
    import mx.events.DropdownEvent;

    public var cards:ArrayCollection = new ArrayCollection(
    [ {label:"Value1", data:100},
    {label:"Value2", data:200},
    {label:"Value3", data:300},
    {label:"Value4", data:400},
    {label:"Value5", data:500}]);

    private function closeHandler(evtropdownEvent):void {
    myLabel.text = "You selected: " + ComboBox(evt.target).selectedItem.label;
    myData.text = "Data: " + ComboBox(evt.target).selectedItem.data;

    <s:Panel title="Halo ComboBox Control Example"
    width="75%" height="75%"
    horizontalCenter="0" verticalCenter="0">
    <s:HGroup left="10" right="10" top="10" bottom="10">
    <mx:ComboBox dataProvider="{cards}" width="150"

    <s:VGroup width="250">
    <s:Label width="200" color="blue" text="Select a type of credit card."/>
    <s:Label id="myLabel" text="You selected:"/>
    <s:Label id="myData" text="Data:"/>


    Attached Images Attached Images

  2. #2
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Here, no there
    Looks like you made this in Flash Builder 4, so the best thing to do if you want the color of the data to change based on the value is to use a item renderer for the combo box.

    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center