PDA

View Full Version : Flash external text


gregsmith
01-31-2006, 02:07 PM
OK, this is doing my head in.
I've revisited a flash project this week that reads in text from external text files using (for example):

_root.loadVariables("past1.txt");

In past1.txt the contents are:


pasttext1=Advantage West Midlands
Atlas Stone
British Waterways
De Marsillac Plunkett Inc
Groundwork Ashfield and Mansfield
Hunter Page Planning Ltd
Marston Hotels
Robert Hitchins

On output it double spaces the list as if there's two <br>'s in between each line like this:

Advantage West Midlands

Atlas Stone

British Waterways

De Marsillac Plunkett Inc

Groundwork Ashfield and Mansfield

Hunter Page Planning Ltd

Marston Hotels

Robert Hitchins

but I want it like this:

Advantage West Midlands
Atlas Stone
British Waterways
De Marsillac Plunkett Inc
Groundwork Ashfield and Mansfield
Hunter Page Planning Ltd
Marston Hotels
Robert Hitchins

I've tried it with HTML turned on and off, with <br> and/or <p> tags in and it still does this silly double spacing thing.
I've tried saving it in utf-8 format.

Can anyone explain why it's doing this please?? I'd really like to be able to just do it like an html page and turn the html on, but it has the same result.

Xeef
01-31-2006, 03:01 PM
problem is windows use as linebreak \n\r no idea what format woud prevent this

try :


a = new LoadVars();
a.onLoad = function() {
trace(unescape(escape(a.pasttext1).split("%0D").join("")));
};
a.load("past1.txt");

gregsmith
02-01-2006, 08:30 AM
Thanks a lot for the reply.

The trace gave me the output that I want without the spaces.

Now how do I get it like that within the movie? (excuse my ignorance)

gregsmith
02-01-2006, 01:10 PM
OK, I've found the solution - it's Textfield.condenseWhite and it's finally documented in Flash 8.

Thanks again.