11 Replies Latest reply on Jan 25, 2009 5:54 PM by kglad

    textArea HTML problem

    W_Bell Level 1
      I have tried the examples and they are not the same as my dynamic text so I am not sure at this point if anyone could help that would be great.

      My textArea component called "UserNotes" is already on stage and the component is set for HTML.
      The text goes into it dynamicaly with the following code:

      _root.UserNotes.text = "Textline 1 stuff <br>Textline 2 stuff<br><Textline 3 stuff <br>";
      This gives me 3 lines of text like I want.

      In the first frame of the textArea I have: UserNotes.setStyle("borderStyle","none");

      This works fine and there is no border. Now I want to set the background to a color or to none.
      I would also like to set the font size and font color. The combinations have not been workinf so far.

      Can anybody please help?

      W Bell.



      This giv
        • 2. Re: textArea HTML problem
          W_Bell Level 1
          kglad, I already tried all that as show below. I put it in the first frame with the textArea component.
          The only style that works is the borderStyle, for what ever reason I don't know.

          UserNotes.setStyle("borderStyle","none");
          UserNotes.setStyle("color",0x3C5375);
          UserNotes.setStyle("backgroundColor","none");
          UserNotes.setStyle("fontSize",24);

          Do you see a problem with assigning these values?
          • 3. Re: textArea HTML problem
            kglad Adobe Community Professional & MVP
            al of them should work except your backgroundColor property. if you're trying to make the textarea's background transparent (and you don't mind making all of them transparent), you can use:

            _global.styles.TextArea.setStyle("backgroundColor", undefined);
            • 4. Re: textArea HTML problem
              kglad Adobe Community Professional & MVP
              (and if you don't want them all to have a transparent background you can use setStyle() on each textarea you want to have a colored background.)
              • 5. Re: textArea HTML problem
                kglad Adobe Community Professional & MVP
                (and each textarea has a depthChild0 property that is the background. so, you can use:

                UserNotes.depthChild0._alpha=0;

                )
                • 6. textArea HTML problem
                  W_Bell Level 1
                  The setStyles I listed above only work if HTML is set to false in the component.
                  Otherwise only the border style is the only one that works.

                  If I set the HTML to off then I lose the line break format and I don't want to set this with globalStyles as there are others that would be affected. There must be a way to define a new style possibly or am I going to have to use CSS? (I would prefer not to unless defined in the same script as I do not want to pull in a seperate css file)
                  • 7. Re: textArea HTML problem
                    clbeech Level 3
                    W - are there 'other' html elements that must be included in the strings? (like href for instance) - one *could* format the fonts and text colors using html tags, and use a combination of kg's suggestion of the depthChild0._alpha assignment and the setStyle for borders.

                    OR if there aren't 'other' html needs and the formatting is purely for line breaks, you could use a return character( \n ) in the string in place of them.

                    _root.UserNotes.text = Textline1+"\n"+Textline2+"\n"+Textline3+"\n";
                    • 8. textArea HTML problem
                      W_Bell Level 1
                      clbeech, this gives me "undefined" wth or without HTML on.
                      _root.UserNotes.text = Textline1+"\n"+Textline2+"\n"+Textline3+"\n";


                      Objective here:
                      UserNotes.setStyle("borderStyle","none"); //Currently works

                      These don't work unless HTML is false:
                      UserNotes.setStyle("color",0x3C5375);
                      UserNotes.setStyle("backgroundColor","none");
                      UserNotes.setStyle("fontSize",24);

                      HTML is "true" for the line break.

                      FootNote: (I am using this dynamic textArea while in FullScreen Mode if that makes a difference)
                      • 9. Re: textArea HTML problem
                        kglad Adobe Community Professional & MVP
                        you need to define Textline1 etc. and you need to use font tags to assign text color and size to a html enabled textarea. and you need to read the above about the various was to make the textarea background transparent.
                        • 10. Re: textArea HTML problem
                          W_Bell Level 1
                          Some global styles play Havok with my php streaming video so I do not use it although
                          the global background style seems to work without a problem but I prefer not to use it.
                          //_global.styles.TextArea.setStyle("backgroundColor",undefined);

                          Instead I Used this with no problem:
                          UserNotes.depthChild0._alpha=0;

                          Also,
                          Here is the HTML tag that worked great:
                          "<font face = 'Times New Roman' size = '18' color = '#3C5375'>This is how you assign HTML text to a text field.</font>";


                          Thank you kglad and clbeech for responding to this thread,
                          We killed another one off.
                          Cheers!

                          WBell.
                          • 11. Re: textArea HTML problem
                            kglad Adobe Community Professional & MVP
                            you're welcome.