3 Replies Latest reply on Dec 13, 2006 7:56 AM by kglad

    Problem using relative sizes on a HTMLtext

    Level 7
      Hi

      I have a problem using relative sizes on a HTMLtext on Flash ActionsScript
      2.0

      Something like:
      htmltext= '<font size="+5">TITLE</font>Text Praragraph...'
      (+5 in normal HTML means is 5 points bigger than the standard text.)


      I create the the textArea i set the size and everything if I do it by
      actionscript everything works fine except when i setup the htmltext, the
      text disspears so I need to re-set the embeded font with:

      myTextFormat.font = Varfont;
      textBox.embedFonts = true;
      textBox.setTextFormat(myTextFormat);


      But using this lines I lose the previous size. that i assigned before when i
      created the textarea. And goes to a standard size... dont know why, i am
      using a different TextFormat.....

      And If i want to use the size i was using , all the text becomes the same
      size (but is the size that I want)...

      If I create the text area manually using the gui, it works well.

      ¬_¬

      >-------------------------------------------------------------------------------------<
      The main problem is... why the the text dissapears when i set a new html
      text???
      >-------------------------------------------------------------------------------------<

      Thanks.









        • 1. Re: Problem using relative sizes on a HTMLtext
          kglad Adobe Community Professional & MVP
          1. where's Varfont defined?
          2. htmtext should be htmlText.
          3. have you defined a linkage id for a library font?
          • 2. Re: Problem using relative sizes on a HTMLtext
            Level 7
            1. Really there are a few functions that i skiped yesterday:
            3. The font is linked and embeded in library.

            public function setHTMLText(texto:String):Void {
            textBox.html = true;
            textBox.htmlText = texto;

            }

            public function setEmbedFont(__font) {
            _font = __font;
            _embed = true;
            setTextStyle(__font);
            }

            public function setTextStyle(__font:String, __bold:Boolean,
            __underline:Boolean, __italic:Boolean) {
            var myTextFormat:TextFormat = new TextFormat();
            myTextFormat.font = _font;
            textBox.setTextFormat(myTextFormat);
            }

            public function setTextSize(__size:Number) {
            var myTextSize:TextFormat = new TextFormat();
            myTextSize.size = _size;
            textBox.setTextFormat(myTextSize);
            }


            Kind of constructor:

            autotext_txt.setTextSize(20);

            //1 if I activate this one the text will dissapear after asigning a new
            text. And I will need to apply the embed font again.
            autotext_txt.setEmbedFont("Arial2");

            autotext_txt.setHTMLText(This is a text (big text) | <font size="-5"
            color="#dddddd"> Small Text</font>');


            autotext_txt.setEmbedFont("Arial2");


            Why dont u have a try?


            Thanks,

            J


            "kglad" <webforumsuser@macromedia.com> escribió en el mensaje
            news:elo6bk$pu3$1@forums.macromedia.com...
            > 1. where's Varfont defined?
            > 2. htmtext should be htmlText.
            > 3. have you defined a linkage id for a library font?


            • 3. Re: Problem using relative sizes on a HTMLtext
              kglad Adobe Community Professional & MVP
              use setNewTextFormat() if you want a textformat to apply to text added after your assignment of a textformat to a textfield.

              and you can only have one textformat assigned to a given textfield at any one time unless you specifiy start and end indices for the textfield's text property that don't coincide.