A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Loading euro sign from external .txt file

  1. #1
    Junior Member
    Join Date
    May 2002
    Posts
    3

    Loading euro sign from external .txt file

    Hi,

    Having problems getting euro sign to display when loaded from external .txt
    file into dynamic text field using:

    var myLv:LoadVars = new LoadVars();
    myLv.load("test.txt");

    myLv.onLoad = function (success) {
    if(success){
    //trace(myLv.myvar);
    my_txt.htmlText=myLv.myvar;
    }
    else{
    trace("not loaded");
    }
    };

    tried saving the test.txt file as UTF-8 no joy, also the myvar above needs to display a bunch of text with a scrollbar, peculiar things happen such as, euro sign doesn't display, or, if I embed the font used, with say Arial, text doesn't display properly, if device fonts are chosen without embed, text displayed doesn't display the euro sign, '€' the common way to code the euro in html doesn't get recognised in .txt file?

    thanks,

    Colm

  2. #2
    Junior Member
    Join Date
    Aug 2004
    Posts
    4

    Post fix

    Hi,

    I was looking for the solution but couldn't find it anywhere. Just figured it out for those who need it (AS3):

    if (myString.charCodeAt(0) == 128) { // first character is a euro symbol
    myString = "\u20AC" + myString.substr(1, myString.length); //replace first character with euro symbol, keep rest of the String the way it is.
    }
    myTextField.text = myString;

    This assumes the euro sign is the first character in the string (position 0), but you of course can modify the above to replace it anywhere in the string.
    Last edited by Cappez; 06-30-2009 at 10:42 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center