3 Replies Latest reply on Jul 23, 2012 11:59 AM by odedreturns1

    HTML Tags Don't Work When Text Resized

    odedreturns1 Level 1

      I have a text field that gets populated dynamically.  If the populated text doesn't fit in the text field, the text gets resized.  HTML tags work correctly in the dynamically populated text, but only if the text doesn't get resized.  HTML tags are completely ignored in resized text.  Any ideas?


      Code to format the text field:

      import flash.text.TextFormat;

      import flash.text.Font;


      function setDesc(str:String):void{

        var fmtD:TextFormat;

        var cfmtD:TextFormat = this.desc_txt.getTextFormat()==null ? this.desc_text.defaultTextFormat : this.desc_txt.getTextFormat();

        var sizeD:int = 22;

        desc_txt.htmlText = str;

        while (sizeD>10 && sizeD<23 && desc_txt.textHeight>255){


           fmtD = new TextFormat(descFont.fontName,sizeD,0x000000,false,false,false);

           desc_txt.htmlText  str;





      Code to populate the text field:

      function openDialog(e:MouseEvent){



              case "btn_structure":

                  dialog_window.setTitle("Title #1 Goes Here");

                  dialog_window.setDesc("Topic description goes here.");


              case "btn_services":

                  dialog_window.setTitle("Title #2 Goes Here");

                  dialog_window.setDesc("<b>Topic</b> description goes <i>here</i>.");




        • 1. Re: HTML Tags Don't Work When Text Resized
          solutionvix Level 1

          The message you sent requires that you verify that you

          are a real live human being and not a spam source.



          To complete this verification, simply reply to this message and leave

          the subject line intact or click the link below:


          http://www.solutionvix.com/cgi-sys/bxd.cgi?a=jeferson@solutionvix.com&id=b9rQp4Knw4ilGW7h1 cmwr-1343061234//www.solutionvix.com/cgi-sys/bxd.cgi?a=jeferson@solutionvix.com&id=b9rQp4Knw4ilGW7h1cmwr-1343061234


          The headers of the message sent from your address are shown below:


          From forums@adobe.com Mon Jul 23 11:33:54 2012

          Received: from mail.sgaur.hosted.jivesoftware.com (:6927 helo=mx-out4.sgvm2hosted.jiveland.com)

               by lagonda.websitewelcome.com with esmtps (TLSv1:AES256-SHA:256)

               (Exim 4.77)

               (envelope-from <forums@adobe.com>)

               id 1StLZy-0008WD-EN

               for jeferson@solutionvix.com; Mon, 23 Jul 2012 11:33:54 -0500

          Received: from adobe-vm-wa05.sgvm2hosted.jiveland.com (unknown )

               by mx-out4.sgvm2hosted.jiveland.com (Postfix) with ESMTP id 0921E600049

               for <jeferson@solutionvix.com>; Mon, 23 Jul 2012 10:33:53 -0600 (MDT)

          Date: Mon, 23 Jul 2012 10:33:52 -0600

          • 2. Re: HTML Tags Don't Work When Text Resized
            Kyle517 Level 1

            I wrote this and it works, maybe this will help:


            var txt:TextField = new TextField();


            txt.width = stage.stageWidth;

            txt.height = stage.stageHeight;

            txt.multiline = true;


            var format:TextFormat = new TextFormat();

            format.size = 20;

            txt.defaultTextFormat = format;




            var str:String = "here <br> <b> are </b> <br> some <br> html <br> <i> tags </i>";


            txt.htmlText = str;


            //stop the script here and the font size is 20.


            function resizeText(o:TextField, size:int):void


                var newFormat:TextFormat = new TextFormat();

                newFormat.size = size;




            resizeText(txt, 12);


            //stop the script here and the font size is 12.

            • 3. Re: HTML Tags Don't Work When Text Resized
              odedreturns1 Level 1

              Solution found on another forum:


              var desc_txt:TextField = new TextField(); addChild(desc_txt);

              function setDesc(str:String):void{

                var sizeD:uint=22;

                var fmtD:TextFormat;

                fmtD = new TextForm(descFont.fontName,sizeD,0x000000,false,false,false);








                while(sizeD>10 && sizeD<23 && desc_txt.textHeight>255){


                   fmtD=new TextFormat(descFont.fontName,sizeD,0x000000,false,false,false);