A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: Getting rid of extra invisble characters which create double line breaks in text

  1. #1
    An Inconvenient Serving Size hurricaneone's Avatar
    Join Date
    Mar 2001
    Location
    You know where
    Posts
    1,918

    Getting rid of extra invisble characters which create double line breaks in text

    Hi

    These characters are created in Notepad when you hit 'Return', making a single line break a double line break when the txt is imported into the swf and viewed off line (online, there actually is no problem, but I'm making a CD presentation).

    Does anyone know a method to get rid of these unseen, unwanted characters?

    (BTW, %0A at the end of the line does not solve the problem )
    Stand by for emergency synapse rerouting

  2. #2
    I had that same problem when using notepad (or copying and pasting from Outlook, for that matter). However, when I copied and pasted the text into Word, then into Flash, it worked fine.
    Don't ask me why, I just know it worked for me!

    Hope this helps!
    Lee

  3. #3
    An Inconvenient Serving Size hurricaneone's Avatar
    Join Date
    Mar 2001
    Location
    You know where
    Posts
    1,918
    Hi Nosferatu,

    Do you mean that you saved your Microsoft Word document as a .txt file and then everything was OK?
    Stand by for emergency synapse rerouting

  4. #4
    Yeah... that worked for me.

  5. #5
    An Inconvenient Serving Size hurricaneone's Avatar
    Join Date
    Mar 2001
    Location
    You know where
    Posts
    1,918
    OK, I'll give it a spin -

    Thanks

    Stand by for emergency synapse rerouting

  6. #6
    An Inconvenient Serving Size hurricaneone's Avatar
    Join Date
    Mar 2001
    Location
    You know where
    Posts
    1,918
    Nice one! - That works a treat.



    You don't know why/how Word is formatting the text so that the additional characters are deleted? (he asks, pushing his luck...)
    Stand by for emergency synapse rerouting

  7. #7
    I don't know for sure, but here's my guess...

    Notepad doesn't have any kind of text formatting options (i.e. line spacing, paragraph formatting, etc...). So, when you hit enter to go to the next line, instead of telling itself "self, we're going to the next line." it has to actually put in a character that tells it to go to the next line.
    Word however, does have all of the formatting options, so when they are not turned on and you hit enter, it just defaults to putting nothing there.

    That probably makes no sense at all, but I couldn't think of any better way to explain it. Plus, it is just a guess, so its probably wrong anyway!

    Glad it worked for 'ya!
    Lee

  8. #8
    An Inconvenient Serving Size hurricaneone's Avatar
    Join Date
    Mar 2001
    Location
    You know where
    Posts
    1,918
    Hey, if that's not the right answer, you can tell a good tale.

    Thanks again.

    Stand by for emergency synapse rerouting

  9. #9
    Anytime!

    Now, I'm going to go home from work and have a beer!


    Lee

  10. #10
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Just a quick note about this, I think notepad is adding \r\n as the newline characters when you hit the return key. Flash interprets each of these as a newline, hence the double spaced text.

    You can strip out one of these characters by using something like,

    variableName = variableName.split("\r").join("");

    leaving single spaced text.

  11. #11
    An Inconvenient Serving Size hurricaneone's Avatar
    Join Date
    Mar 2001
    Location
    You know where
    Posts
    1,918
    Hi catbert

    I'm glad you decided to post, because I was just playing around with the solution Nosferatu posted and I was still getting the same old problem of one additional line break inserted offline (so when you're viewing offline there's a two line break, but online there's the desired one line empty format).

    I'll give this one a whirl.
    Stand by for emergency synapse rerouting

  12. #12
    An Inconvenient Serving Size hurricaneone's Avatar
    Join Date
    Mar 2001
    Location
    You know where
    Posts
    1,918
    Hey there,

    I'm using loadVariables to call the .txt file and I'm having a little trouble (OK, I have no idea) figuring out how to adapt the line you posted to suit this.

    Could you help me out, considering that the text file is text/descriptions.txt and it's being used in the _parent clip.

    Cheers for any help
    Stand by for emergency synapse rerouting

  13. #13
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Hi,

    okay, let's say you have a movie clip to handle the loading which is placed on the timeline that contains your dynamic textboxes. if you have the variables myVar1 and myVar2 in the textfile (and corresponding variable names for the dynamic textboxes) you can use something like this as a clip event to do the loading,

    onClipEvent(load) {
    this.loadVariables("./text/descriptions.txt");
    }
    onClipEvent(data) {
    _parent.myVar1 = myVar1.split("\r").join("");
    _parent.myVar2 = myVar2.split("\r").join("");
    }

    this would load the variables into the clip, and then set the corresponding variables in the parent timeline to the contents of the orginal variables minus the \r characters.

  14. #14
    An Inconvenient Serving Size hurricaneone's Avatar
    Join Date
    Mar 2001
    Location
    You know where
    Posts
    1,918
    I'm trying to put it together as I write this...
    Stand by for emergency synapse rerouting

  15. #15
    An Inconvenient Serving Size hurricaneone's Avatar
    Join Date
    Mar 2001
    Location
    You know where
    Posts
    1,918
    My tentative response is

    YAHOOOO!

    but I'm still testing.

    So far, with your script Catbert, I'm getting the same line breaks on and offline. I just need a little more time.

    There was also something that Nosferatu might've done as well, because one of the txt files was double-spacing, while the other was not, and I think the one which was not (the one which was correct) was the one I ran through Word.

    Ah well, you both get gold stars in my book.

    I'll let ya know if things are still going well after further experiments.

    Cheers
    Stand by for emergency synapse rerouting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center