Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 410
  • Last Modified:

How do I get special characters (e.g. ö,ä,ü) from an external .txt file loaded into a dynamic Textfield?

I am loading with the LoadVars object text from an external .txt file into a dynamic text area. The font to be used has been imported into the library, exported for ActionScript and embedded in the text area by setting the embed property to true.  
The external text includes special characters as it is written in German.  These however do not seem to transfer into Flash.  How do I get the special characters of the external text to display correctly in the .swf file?
0
Parlian
Asked:
Parlian
  • 5
  • 2
1 Solution
 
ddlamCommented:
just save the .txt in UTF-8 format
0
 
ParlianAuthor Commented:
Unfortunately it did not do the trick as yet, did however change the appearance in the .txt file and I suppose it was one piece of the puzzle missing to bring me closer to the solution.

Another problem I do have with this, is that the text displays in bold, and I cannot get the text formatting to change within Flash.  The source might be the same mistake.

 

0
 
ParlianAuthor Commented:
Here is a sample of the relevant part of the code

      var tfHeading:TextFormat = new TextFormat();
      with (tfHeading) {
            font = "Verdana";
            bold = true;
            color = 0x660000;
            size = 12;
      };
      var tfContent:TextFormat = new TextFormat();
      with (tfContent) {
            font = "Verdana";
            bold = false;
            color = 0x660000;
            size = 12;
      };

      mcComContent.txtHeading.embedFonts = mcComContent.txtContent.embedFonts =true;
      mcComContent.txtHeading.setNewTextFormat(tfHeading);
      mcComContent.txtContent.setNewTextFormat(tfContent);

      var ComData:LoadVars = new LoadVars();
      ComData.load("COMinfo.txt");
      ComData.onLoad = function() {
            mcComContent.txtHeading.text = ComData.title1;
            mcComContent.txtContent.text = ComData.content1;
      };
}
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Aneesh ChopraCommented:
here is my approach,

create a dynamic textField on first frame and keep it out of stage area so that it does not show up when swf runs..
no need to assign instance name..

now, selecte the same font for this txtField which you want to use in other textFields
next step is, select the textField and click embed to open "Character Embedding" dialog.
now enter all special characters in "include these character" textField and click ok

you are done,

now these characters should work fine with all dynamically created textfield also.
0
 
ParlianAuthor Commented:
When the text is created within Flash(AS), e.g. self labeling buttons, the special characters display fine with all dynamically created textfields.  
Only, the text which I load from an external file, created with Notepad, still omits the special characters.  

By now I have saved the text file in UTF-8 format, as suggested by ddlam, and added the textField, as suggested by aneeshchopra, unfortunately no special characters to be seen in these fields so far.

Maybe it plays a role that  the whole thing is created with slides, but I would not know why.
0
 
Aneesh ChopraCommented:
can you upload your sample source file with external source file for review?
0
 
ParlianAuthor Commented:
Hello aneeshchopra

Please find attached the external text file, as well as a copy of the ActionScript, which is allocated to the slide containing the textField movie clip.  I hope this is what you meant. Sorry, I am not quite familiar with the terminologies, as yet, and am not sure what the sample source file is within Flash.

The external Data was only for testing, and length of content1 for testing the scroll component.

Additionally I still do not seem to get rid of the bold  text in the content textField, but am able to manipulate text size and color with the TextFormat object.

Thank you for looking at it

Parlian
COMinfo.txt
AS2-Code.txt
0
 
ParlianAuthor Commented:
Hello ddlam and aneeshchopra

I got it working (surprise, surprise) and the solution was with the format of the external .txt file. Thank you ddlam.
I am afraid I cannot say exactly what I did as I was (being very inexperienced)  just playing around with the encoding and converting, to and fro AINSI and UTF-8, until I had the text encoded in UTF-8 format with the special characters not showing as E4s or something similar.

Thank you for your support
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now