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

Posted on 2008-06-20
Last Modified: 2013-11-11
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?
Question by:Parlian
  • 5
  • 2

Accepted Solution

ddlam earned 500 total points
ID: 21837135
just save the .txt in UTF-8 format

Author Comment

ID: 21837206
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.



Author Comment

ID: 21837277
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;

      var ComData:LoadVars = new LoadVars();
      ComData.onLoad = function() {
            mcComContent.txtHeading.text = ComData.title1;
            mcComContent.txtContent.text = ComData.content1;
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

LVL 34

Expert Comment

by:Aneesh Chopra
ID: 21839926
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.

Author Comment

ID: 21840460
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.
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 21840896
can you upload your sample source file with external source file for review?

Author Comment

ID: 21841240
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


Author Comment

ID: 21842408
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

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do I change text in a Flash (FLA, SWF) file? 3 998
Flash being Disabled - help! 20 340
blocked plugin flash 5 117
bandwidth 5 69
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now