Text formatting problem

I have a problem when loading an external .txt file. Flash turns this:

"CV Verificatie, keurmerk voor uw sollicitatie

Het Curriculum Vitae Keurmerk, maakt uw sollicitatie ijzersterk."

into this:

“CV%20Verificatie%2C%20keurmerk%20voor%20uw%20sollicitatie%0A%0A
Het%20Curriculum%20Vitae%20Keurmerk%2C%20maakt%20uw%20sollicitatie%20ijzersterk”

The script:

var loadText:LoadVars = new LoadVars();
loadText.load(“text/01_overons_01.txt”);
loadText.onLoad = function(success) {
if (success) {
txt_load.text = loadText;
} else {
txt_load.text = “error”;
}
}

Please help!

Hmm it seems like it have’nt removed all url-encodings as it should. try to run it through unescape() first.

BTW do you have a “loadText” variable on the same timeline? as there is no “this” before it in the onLoad event it could be taking such a variable’s content instead.


var loadText:LoadVars = new LoadVars();
loadText.load("text/01_overons_01.txt");
loadText.onLoad = function(success) {
   if (success) {
      txt_load.text = **unescape(this.loadText);**
   } else {
      txt_load.text = "error";
   }
}

/Mirandir

It doens’t seem to work, but thanks for helping, now I know of this unescape() command. This is the only loadText variable on the timeline, I have all the text in the movieclip but I want to get it all external, so this is just the first frame I’m trying. Besides, the variable LoadText with a capital L (I think).

Don’t know what you mean with the “this” bit.

It works now, I changed the period to a comma.


var loadText:LoadVars = new LoadVars();
loadText.load("text/01_overons_01.txt");
loadText.onLoad = function(success) {
   if (success) {
      txt_load.text = **unescape(this,loadText);**
   } else {
      txt_load.text = "error";
   }
}

Thanks!

Aaah now I see. you’re assigning the actual LoadVars object to the textfield. Well that explains everything. My reference to this was assuming that loadText was a variable loaded with the LoadVars object. So in that code you can actually remove the loadText reference completetly and go with just “this”.

/Mirandir