22 Replies Latest reply: Apr 8, 2012 12:37 PM by kglad RSS

    problem with characters in text field

    macromediaRocked

      hi all

       

      i am missing a few characters, once i load text into a dynamic text field. chars are not missing per say; they are being replaced with empty squares.

      characters like the euro sign and accentuated german a letter.

      whats is weird is that other accentuated german letters do appear. so only a few selected are missing.

       

      How ive set up the fla:

      1) i've added 4 text fields to the stage in the font im using, Arial, one for each font style: normal, italic, bold and bold italic, and in all 4 fields ive embedded all latin characters (to include the german accentuaded characters and im guessing it's in the punctuation group that holds the euro sign, so that one is also embedded), besides lowercase, uppercase, numerical, and all the default groupd to include basic text.

       

      2) i've got a dynamic text field, created with createTextField, and setup the following ActionScript (2):

       

      this.createTextField("T_text",1,0,10,Stage.width-60,50);

      var myFmt = new TextFormat();

      myFmt.size = 12;

      myFmt.leading = 3;

      myFmt.font = "Arial";

      T_text.html = true;

      T_text.autoSize = "left";

      T_text.multiline = true;

      T_text.wordWrap = true;

      T_text.selectable = false;

      T_text.embedFonts = false;

      T_text.textColor = "0x666666";

      T_text.htmlText = _global.gallery_1_image_text_1; // this holds the text im displayed, called in from a database.

      T_text.setNewTextFormat(myFmt);

       

      now, im calling text from a database.

      when calling the text from the browser  url bar, there's no chars missing.

      its just when i make this call from flash and load the text into the dynamic text field, that characters go missing.

       

      below is a link to a print screen of the faulty text that is displayed in flash's dynamic text field.

       

      http://img210.imageshack.us/img210/340/utf8.png

       

      any ideas? i mean, it seems that the arial font is missing a few accentuated characters! because the code i have setup loads other accentuated characters.

      anyone has seen this issue before and know how to solve it?

       

      regards

        • 1. Re: problem with characters in text field
          kglad CommunityMVP

          embed your font.

          • 2. Re: problem with characters in text field
            macromediaRocked

            hi kglad

             

            how do you mean? i've placed dynamic text fields on the stage including all four font styles (bold, italic, normal, etc) and embedded all glyphs i need into them.

            • 3. Re: problem with characters in text field
              kglad CommunityMVP

              use:

               

              T_text._rotation=3;

               

              and let me know if you see any text in that textfield.

              • 4. Re: problem with characters in text field
                macromediaRocked Community Member

                no, i do not see the text.

                does this mean that the font isnot embedded?

                • 5. Re: problem with characters in text field
                  kglad CommunityMVP

                  correct.  you've not correctly embedded your needed font.

                   

                  click on the upper right of your library panel > new Font > select Arial and tick the symbols you need to embed > tick export for actionscript and assign a linkage id (eg, ArialID). click ok.  then use:

                   

                  this.createTextField("T_text",1,0,10,Stage.width-60,50);

                  var myFmt = new TextFormat();

                  myFmt.size = 12;

                  myFmt.leading = 3;

                  myFmt.font = "ArialID";

                  T_text.html = true;

                  T_text.autoSize = "left";

                  T_text.multiline = true;

                  T_text.wordWrap = true;

                  T_text.selectable = false;

                  T_text.embedFonts = true;

                  T_text.textColor = 0x666666;  // no quotes here.  this is a number

                  T_text.htmlText = _global.gallery_1_image_text_1; // this holds the text im displayed, called in from a database.

                  T_text.setTextFormat(myFmt);  // to format the above text, use setTextFormat().  if you want to format text added after this line, use setNewTextFormat()

                  • 6. Re: problem with characters in text field
                    macromediaRocked Community Member

                    kglad, you mean i must select the styles i want to include in the font?

                     

                    i have done that (together with adding the font to the library - like you said) but the result is that i get all the text in bold italic.

                    plus, the charactersare still missing from the text. plus, i am using bitmap text.

                    i don't know if that influences anything.

                     

                    ive attached an fla with the work im doing

                    http://starting-grounds.info/actionscript2/UTF%208%20Text%20in%20Dynamiclly%20Created%20Te xtfield.zip

                     

                    any plus help will be appreciated.

                    • 7. Re: problem with characters in text field
                      kglad CommunityMVP

                      no.  but you must embed each font/font family you want to use in that textfield.

                       

                      if you have more than one font/font family you want to use, you can embed all the fonts/font families in "dummy" textfields and assign fonts using html tags or a stylesheet.

                       

                      p.s.  i don't download and correct files unless hired.  for free help, continue posting here.

                      • 8. Re: problem with characters in text field
                        macromediaRocked Community Member

                        how do i embbed variants of the same font though?

                        i need arial normal, italic, bold and bold italic, but i can only assign the font linkage identifier to one font variant in the library.

                         

                        regards

                         

                        edit: the attached file is not what i'm working on - it's just a fla with the code posted here on this topic so it's easier to follow what i'm doing.

                         

                        thanks

                        • 9. Re: problem with characters in text field
                          kglad CommunityMVP

                          you can use as many textformat instances as needed to embed each of the families but you must embed them each the same as you would for different fonts.

                           

                          you can do with with code using different textformat instances and setTextFormat() (it accepts parameters to specify which font applies to which section(s) of text) or you can use the ide to add dummy textfields.

                           

                          p.s.  you can attach screenshots to this forum.

                          • 10. Re: problem with characters in text field
                            macromediaRocked Community Member

                            thanks, but regarding the dummy textfields, ive tried addind four dynamic textfields on the stage, one for each font variant, and embedded the glyphs needed into all four, but i still cannot get some special characters to show up...

                             

                            the dummy textfiled are placed before the textfield that will display text using all four variants.

                             

                            any tips as to what i still need to do, or any idea why some characters dont show?

                             

                            thanks

                            • 11. Re: problem with characters in text field
                              macromediaRocked Community Member

                              can anyone help?

                              i am not being able to include some special chars into a dynamicly created dynamic text field, using createTextField.

                              characters like ä and the euro sign are turned into squares

                               

                              missingGermanChars2.PNG

                              • 12. Re: problem with characters in text field
                                kglad CommunityMVP

                                they don't show because you have not correctly embedded a font that contains those characters and that has been assigned to the problematic textfield(s).

                                • 13. Re: problem with characters in text field
                                  macromediaRocked Community Member

                                  hi kglad

                                   

                                  is my embedding code

                                   

                                  this.createTextField("T_text",1,0,10,Stage.width - 60,10);

                                  var txtArial:TextFormat = new TextFormat();

                                  var txtArialBold:TextFormat = new TextFormat();

                                  var txtArialItalic:TextFormat = new TextFormat();

                                  var txtArialBoldItalic:TextFormat = new TextFormat();

                                  txtArial.size = 12;

                                  txtArial.leading = 3;

                                  txtArial.font = "Arial";

                                  txtArialBold.size = 12;

                                  txtArialBold.leading = 3;

                                  txtArialBold.font = "ArialBold";

                                  txtArialItalic.size = 12;

                                  txtArialItalic.leading = 3;

                                  txtArialItalic.font = "ArialItalic";

                                  txtArialBoldItalic.size = 12;

                                  txtArialBoldItalic.leading = 3;

                                  txtArialBoldItalic.font = "ArialBoldItalic";

                                  T_text.html = true;

                                  T_text.autoSize = "left";

                                  T_text.multiline = true;

                                  T_text.wordWrap = true;

                                  T_text.selectable = false;

                                  T_text.embedFonts = false;

                                  T_text.textColor = "0x666666";

                                  T_text.htmlText = "Dies ist ein Typoblindtext. An ihm kann man sehen, ob alle Buchstaben da sind und wie sie aussehen. Manchmal benutzt man Worte wie Hamburgefonts, Rafgenduks oder Handgloves, um Schriften zu testen. Manchmal Sätze, die alle Buchstaben des Alphabets enthalten - man nennt diese Sätze Pangrams. Sehr bekannt ist dieser: The quick brown fox jumps over the lazy old dog. Oft werden in Typoblindtexte auch fremdsprachige Satzteile eingebaut (AVAIL® and Wefoxâ„¢ are testing aussi la Kerning), um die Wirkung in anderen Sprachen zu testen. In Lateinisch sieht zum Beispiel fast jede Schrift gut aus. Quod erat demonstrandum. Seit 1975 fehlen in den meisten Testtexten die Zahlen, weswegen nach TypoGb. 204 § ab dem Jahr 2034 Zahlen in 86 der Texte zur Pflicht werden. Nichteinhaltung wird mit bis zu 245 € oder 368 $ bestraft.";

                                  T_text.setNewTextFormat(txtArial);

                                  T_text.setNewTextFormat(txtArialBold);

                                  T_text.setNewTextFormat(txtArialItalic);

                                  T_text.setNewTextFormat(txtArialBoldItalic);

                                   

                                  correct?

                                   

                                  regards

                                  • 14. Re: problem with characters in text field
                                    kglad CommunityMVP

                                    no.

                                     

                                    you assigned your embedFonts property to be false.

                                     

                                    look, you can test if you've embedded fonts correctly by using:

                                     

                                    T_text._rotation=3;

                                     

                                    if you see no text, you're not embedding fonts correctly.

                                     

                                    so, use:

                                     

                                    T_text.embedFonts=true;

                                     

                                    and then test.  if you see no text, use:

                                     

                                    /////////////////////////////////////////////////////////

                                    click on the upper right of your library panel > new Font > select Arial and tick the symbols you need to embed > tick export for actionscript and assign a linkage id (eg, ArialID). click ok.  then use:

                                     

                                    this.createTextField("T_text",1,0,10,Stage.width-60,50);

                                    var myFmt = new TextFormat();

                                    myFmt.size = 12;

                                    myFmt.leading = 3;

                                    myFmt.font = "ArialID";

                                    T_text.html = true;

                                    T_text.autoSize = "left";

                                    T_text.multiline = true;

                                    T_text.wordWrap = true;

                                    T_text.selectable = false;

                                    T_text.embedFonts = true;

                                    T_text.textColor = 0x666666;  // no quotes here.  this is a number

                                    T_text.htmlText = _global.gallery_1_image_text_1; // this holds the text im displayed, called in from a database.

                                    T_text.setTextFormat(myFmt);  // to format the above text, use setTextFormat().  if you want to format text added after this line, use setNewTextFormat()

                                    • 15. Re: problem with characters in text field
                                      macromediaRocked Community Member

                                      okay, i successfully embedded the font - it's rotating...

                                      so, the missing character problem is not font embedding related.

                                      the missing characters, i found out, is a charset problem.

                                       

                                      still would appretiate input on how to embed multiple font variants using actionscript.

                                      • 16. Re: problem with characters in text field
                                        kglad CommunityMVP

                                        you embed multiple fonts just like you embed one font.

                                         

                                        assigning different fonts in one textfield can be done using setTextFormat() but is awkward and prone to errors or using the stylesheet class.  that later is much preferred.

                                        • 17. Re: problem with characters in text field
                                          macromediaRocked Community Member

                                          hi kglad

                                          im actually trying to embed the same font, but with it's variants, bold, italic, etc.

                                          • 18. Re: problem with characters in text field
                                            kglad CommunityMVP

                                            doesn't matter.  it's the same to flash.  different font styles are handled the same as different font families.

                                            • 19. Re: problem with characters in text field
                                              macromediaRocked Community Member

                                              thanks kglad.

                                               

                                              i still havent been able to use all variants though.

                                               

                                              im using the multiple setTextFormat (i  posetd above)

                                              but the text doesnt appear correctly. instead it appears with the last setTextFormat format i added, meaning all of it is italic and bold.

                                              is the script incorrect?

                                               

                                              regards

                                              • 20. Re: problem with characters in text field
                                                kglad CommunityMVP

                                                no.  your script is going to do exactly what you see.

                                                 

                                                to use setTextFormat() to assign multiple font families/styles in the same textfield, you must use the 2nd and 3rd parameters to indicate which text indices should be using which textformat.  for example, you should be using something like:

                                                 

                                                T_text.setNewTextFormat(0,40,txtArial);

                                                T_text.setNewTextFormat(40,99,txtArialBold);

                                                T_text.setNewTextFormat(99,111,txtArialItalic);

                                                T_text.setNewTextFormat(111,200,txtArialBoldItalic,);

                                                • 21. Re: problem with characters in text field
                                                  macromediaRocked Community Member

                                                  that is by far the worst way adobe thought of to allow multiple font variants into a single text field.

                                                  • 22. Re: problem with characters in text field
                                                    kglad CommunityMVP

                                                    yes, that's why they added stylesheet support and why i said, "assigning different fonts in one textfield can be done using setTextFormat() but is awkward and prone to errors or using the stylesheet class.  that later is much preferred."