2 Replies Latest reply on Aug 9, 2010 1:44 PM by Flex harUI

    Selectable <mx:Label> background color property


      How can I change background color of selected text in my mx:Label when selectable=true.  Default color is blue.

      thanks in advance

        • 1. Re: Selectable <mx:Label> background color property
          ShardulSingh Level 3



          I think you should use something else for this use instead of Label.That will be better.


          But if you want to do this with Label only then the solution is as below.

          Create you own Label class which extends Label class of flex.And then use as I hv used it in my application.Below is the source

          code for both.





              import mx.controls.Label;
              public class CustomLabel extends Label
                  public function CustomLabel()
                  public function getTxt() : *
                      return textField;





          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                      private function onCreationComplete():void
                          customLabel.getTxt().background = true;
                          customLabel.getTxt().backgroundColor = '0xFFFF00';
              <local:CustomLabel id="customLabel" text="Hello world" selectable="true" creationComplete="onCreationComplete()"/>





          Let me know if u hv any issue.





          with Regards,

          Shardul Singh Bartwal

          • 2. Re: Selectable <mx:Label> background color property
            Flex harUI Adobe Employee

            You can't change the selection color in mx:Label.