Skip to main content
Participant
July 20, 2006
Answered

importing special characters from text file

My project requires me to import a text file into a dynamic text field by using the loadVariables() function. My problem is that the text file contains a ampersign "&" . It seems that the ampersign stops the rest of the text from being imported into my flash movie. Is there a special character or escape character that I can use to allow me to import the ampersign?

I've tried using the & and setting my dynamic text field to HTML. No luck. Oh.. I'm using flash MX :(

Any ideas?
This topic is closed to new replies. Start a new post to keep the conversation going.
parker7211986Correct answer
Participant
July 20, 2006

4 replies

kglad
Community Expert
Community Expert
July 22, 2006
you're welcome (and that's url-encoding).
Translate
Participating Frequently
July 20, 2006
Hey I've run into this problem and found the solution lies with JavaScript which can read the text just fine and then parse it back to Flash as escape characters:

//JavaScript code:
var origText = 'blah blah & then i did this & then blah blah";

var newText = String(escape(origText).replace(new RegExp('\\+', 'g'), '%2b'));
FlashWin.sendText(newText); // << this is a reference to a flash window with ExternalInterface enabled

// end

However, I was using HttpRequest in JS to get my original data. So this method is dependent on something other than Flash to retrieve the original text (with ampersands).

I really hope they fix this bug in the future, it can drive you nuts....

-Dan

Translate
parker7211986AuthorCorrect answer
Participant
July 20, 2006
kglad
Community Expert
Community Expert
July 20, 2006
yes, url-encode your characters: http://www.albionresearch.com/misc/urlencode.php

Translate