-
Importing text from a txt file
I am importing text from a txt file into a array, the elements of which are fed into a number of dynamic text boxes. Am using the follow code to do this:
files = new Array();
lv = new LoadVars();
lv.onLoad = function() {
fl = this.filelist;
files = fl.split(",");
c = files.length-1;
};
lv.load("question1.txt");
The text file includes + and % characters and when the files are imported into the array and put in the text boxes in flash these characters disappear. Can anyone explain why and how i can prevent this? Thanks
-
Flash is expecting the contents of your text file to have the following MIME type: application/x-www-form-urlencoded.
What that means is plus signs ("+") are actually treated as spaces, and percent signs ("%") are used to denote the beginning of a hexadecimal character code.
To literally get the plus sign, replace "+" with "%2B" in your text file (2B is the hex code for the "+" character).
To get the percent sign, replace "%" with "%25" in your text file.
When Flash loads the file, it will replace all "%2B" with "+" and all "%25" with "%".
-
Thanks webbrowser!! That's done the trick!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|