3 Replies Latest reply on Jun 9, 2008 1:31 PM by Garyl Woolworth

    How to BOLD some text in TEXT control?

      I am using {'\n'} for line break. Which HTML tag <should be <b> > should bold the first 2 words of the sentence?
      Plus How do I insert a BULLET before "Smaller"

      <mx:Text color="#F9CD00" text="Top Reports{'\n'}Smaller Ventricular Assist Device Gets Nod From FDA/>
        • 1. Re: How to BOLD some text in TEXT control?
          2 ways -

          <?xml version="1.0"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
          backgroundGradientColors="[#FFFFFF, #FFFFFF]">
          <mx:Text width="100%" color="blue" fontStyle="italic" fontSize="14">
          This is 14 point blue italic text.<br>
          <b><font color="#000000" size="10">This text is 10 point black, italic, and bold.</font></b>


          var myTextField:TextField = new TextField();
          myTextField.text = "No matter where you click on this text field the TEXT IN ALL CAPS changes format.";
          myTextField.autoSize = TextFieldAutoSize.LEFT;
          addEventListener(MouseEvent.CLICK, changeText);

          var myformat:TextFormat = new TextFormat();
          myformat.color = 0xFF0000;
          myformat.size = 18;
          myformat.underline = true;

          function changeText(event:MouseEvent):void
          myTextField.setTextFormat(myformat, 49, 65);


          • 2. Re: How to BOLD some text in TEXT control?
            Shelady Level 1
            Thanks for replying but as you can see that I am using {'\n'} as line break here. I want to use similar strategy with bold tag. {} and tag inside. Any suggestion?

            And How can I insert the bullit here?

            • 3. Re: How to BOLD some text in TEXT control?
              Garyl Woolworth Level 1
              For bullets you can use '<li>' and '</li>'. So "<li>This is a bulleted item.</li>". As far as the bold tag there is no simple tag you could use like that, the bold tag needs to know where to start and where to end; where as the {'\n'} knows to create that newline there and continue on. You would still need to do it "<li><b>This</b> is a bulleted item.</li>" unless you wanted to create your own processing script that looked for special characters and set formats based on those, but then you are creating a lot of work for yourself for a simple bold.