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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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;
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

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 have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

636 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