Skip navigation
macromediaRocked
Currently Being Moderated

problem with characters in text field

Mar 28, 2012 4:04 AM

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

 
Replies
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 28, 2012 7:49 AM   in reply to macromediaRocked

    embed your font.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 28, 2012 9:21 AM   in reply to macromediaRocked

    use:

     

    T_text._rotation=3;

     

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

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 28, 2012 7:20 PM   in reply to macromediaRocked

    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()

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 29, 2012 6:57 AM   in reply to macromediaRocked

    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.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 29, 2012 7:24 AM   in reply to macromediaRocked

    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.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 3, 2012 7:33 PM   in reply to macromediaRocked

    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).

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 4, 2012 7:02 AM   in reply to macromediaRocked

    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()

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 5, 2012 8:52 AM   in reply to macromediaRocked

    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.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 6, 2012 12:33 PM   in reply to macromediaRocked

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

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 6, 2012 5:20 PM   in reply to macromediaRocked

    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,);

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 8, 2012 12:37 PM   in reply to macromediaRocked

    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."

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points