5 Replies Latest reply on Jan 30, 2009 12:48 AM by magouveia

    Semi-transparent text

    magouveia
      Hello,
      I'd like to display text in a semi-transparent background. Neither Label nor TextField have the backgroundAlpha attribute which is what I think I need. Is there any workaround to achieve the same effect?
      Thanks, Marco
        • 1. Re: Semi-transparent text
          PushkinAl
          Use TextArea.
          • 2. Re: Semi-transparent text
            Gregory Lafrance Level 6
            And if for some reason you do not want the focus and border to appear, you can set these styles:

            focusThickness 0
            borderStyle none
            • 3. Re: Semi-transparent text
              magouveia Level 1
              Thank you, textArea apparently does I need.
              However, I can´t control it as well as I do with the textfield:

              If I create it in design mode
              <mx:TextArea id="TA1" text="Hello World" fontWeight="bold" fontStyle="italic" borderThickness="0">

              I can't change it's location in run-time. The following code:

              TA1.text='new text'
              TA1.x=100;
              TA1.y=100;

              changes the text but not the location.


              If I create it in run-time, I can change location but can't access font related attributes like fontWeight or fontStyle.

              var TF:TextArea = new TextArea();
              TF.x = 100;
              TF.y = 100;
              TF.wordWrap = true;
              TF.text='RunTime TextArea';
              TF.fontWeight="bold";
              this.rawChildren.addChild(TF);

              I get the following error:
              1119: Access of possibly undefined property fontWeight through a reference with static type mx.controls:TextArea

              Any ideas?
              I know this is basic stuff but I'm just starting...

              Thank you
              Marco
              • 4. Re: Semi-transparent text
                Level 7

                "magouveia" <webforumsuser@macromedia.com> wrote in message
                news:glsvgu$r3b$1@forums.macromedia.com...
                > Thank you, textArea apparently does I need.
                > However, I can?t control it as well as I do with the textfield:
                >
                > If I create it in design mode
                > <mx:TextArea id="TA1" text="Hello World" fontWeight="bold"
                > fontStyle="italic"
                > borderThickness="0">
                >
                > I can't change it's location in run-time. The following code:
                >
                > TA1.text='new text'
                > TA1.x=100;
                > TA1.y=100;
                >
                > changes the text but not the location.
                >
                >
                > If I create it in run-time, I can change location but can't access font
                > related attributes like fontWeight or fontStyle.
                >
                > var TF:TextArea = new TextArea();
                > TF.x = 100;
                > TF.y = 100;
                > TF.wordWrap = true;
                > TF.text='RunTime TextArea';
                > TF.fontWeight="bold";
                > this.rawChildren.addChild(TF);
                >
                > I get the following error:
                > 1119: Access of possibly undefined property fontWeight through a reference
                > with static type mx.controls:TextArea
                >
                > Any ideas?
                > I know this is basic stuff but I'm just starting...

                fontWeight is a style. Try TF.setStyle('fontWeight', 'bold');

                FWIW, most Flex developers only give Classes a capital name. Instances are
                typically named with camel case.

                HTH;

                Amy


                • 5. Re: Semi-transparent text
                  magouveia Level 1
                  Great, that's it!
                  Thank you.