2 Replies Latest reply on Sep 13, 2011 8:21 AM by saifsid9

    Change the color of selecteditem in a LIST FLEX

    saifsid9

      i WANT TO CHANGE THE COLOR OF SELECTEDITEM IN A LIST.  WHEN EVER USER DOUBLE CLICK THE ITEM IT SHOULD CHANGE THE COLOR...

        THIS IS MY LIST WITH DOUBLE CLICK EVENT...PLEASE HELP.....THIS SEEMED SO SIMPLE BUT I ALREADY SPENT FEW HOURS..

       

      HELP WILL BE APPRECIATED. THANKS

       

      <s:List id="shopslist1" left="0" right="0" top="57" bottom="0"
                  initialize="shopslist1.dataProvider=actions" labelField="details" color="Red"   doubleClick="shopslist1_doubleClickHandler(event)">      
                                   
          </s:List>

      protected function shopslist1_doubleClickHandler(event:MouseEvent):void
                  {
                      shopslist1.selectedItem. ?????????
                 
                     
                     
                  }

        • 1. Re: Change the color of selecteditem in a LIST FLEX
          Vibhuti Gosavi(InfoCepts) Level 3

          Hello,

           

          Please see following code:

           

          <?xml version="1.0" encoding="utf-8"?>

          <!-- dpcontrols\spark\SparkListSimpleStyles.mxml -->

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

             xmlns:s="library://ns.adobe.com/flex/spark"

             xmlns:mx="library://ns.adobe.com/flex/mx">

          <s:layout>

          <s:VerticalLayout/>

          </s:layout>

           

          <fx:Script>

          <![CDATA[

           

          protected function myList_doubleClickHandler(event:MouseEvent):void

          {

          myList.setStyle("selectionColor" ,"#CC6600");

           

          }

           

          ]]>

          </fx:Script>

           

           

          <s:List id="myList"

          alternatingItemColors="[#66FFFF, #33CCCC]"

              doubleClick="myList_doubleClickHandler(event)">

          <s:dataProvider>

          <mx:ArrayCollection>

          <fx:String>Flex</fx:String>

          <fx:String>Flash Builder</fx:String>

          <fx:String>Flash</fx:String>

          <fx:String>Director</fx:String>

          <fx:String>Dreamweaver</fx:String>

          <fx:String>ColdFusion</fx:String>

          </mx:ArrayCollection>

          </s:dataProvider>

          </s:List>

          </s:Application>

           

           

          Thanks and Regards,

          ------------------------------------------------------------------------------------------ --

          Vibhuti Gosavi | vgosavi@infocepts.com | www.infocepts.com

          ------------------------------------------------------------------------------------------ --

          • 2. Re: Change the color of selecteditem in a LIST FLEX
            saifsid9 Level 1

            Thanks that really worked.. i appreciate it.