dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Loading external text with multiple spaces

  1. #1
    Member
    Join Date
    May 2006
    Posts
    70

    Loading external text with multiple spaces

    Hi everyone. I have been trying to get this working right for days and it is driving me crazy. It should be very easy, so I'm not sure what I'm missing.

    I'm loading in an external text file, which is fine, but the problem is with how it is displaying.

    It should look like the attached word file. But when I paste it in a text file it gets messed up. A sample of that is attached as well. I have tried making it look the same in the notepad file, but that doesn't come out right in the flash.

    I have tried everything, importing as html, using xml files, copying the text into different programs and then into the text file.

    If anyone could help me out I'd really appreciate it. Or if you could perhaps make a sample fla importing a text file that comes out looking like the word file that would be great.

    Thanks!
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    You need tabs. Something like:

    PHP Code:
    // Create a new text field.
    this.createTextField("table_txt"995050450100);
    table_txt.multiline true;
    table_txt.html true;
    // Creates column headers, formatted in bold, separated by tabs.
    var rowHeaders:String "<b>Name\tAge\tOccupation</b>";

    // Creates rows with data.
    var row_1:String "Rick\t33\tDetective";
    var 
    row_2:String "AJ\t34\tDetective";

    // Sets two tabstops, at 50 and 100 points.
    table_txt.htmlText "<textformat tabstops='[50,100]'>";
    table_txt.htmlText += rowHeaders;
    table_txt.htmlText += row_1;
    table_txt.htmlText += row_2 ;
    table_txt.htmlText += "</textformat>"
    Example from the liveDocs

    gparis

  3. #3
    Member
    Join Date
    May 2006
    Posts
    70
    Ok I see. That does help some, thanks. Now I'm just having a problem getting that to work from an external text file.

    Ugh, so frustrating! Any ideas there?

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Write \t whenever you need a tab (instead of spaces), like in the posted example:

    Rick\t33\tDetective

    Works well from a textfile.

    gparis

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