A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Line break prob with ext txt file in AS 3 - help!

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    15

    Line break prob with ext txt file in AS 3 - help!

    Hi

    I've found a couple of solutions to the line break problem where you end up with two carriage returns even though you only have one in an external .txt file, but they haven't worked. Can anyone help me on this one?

    Here's my AS code:

    var textRequest:URLRequest = new URLRequest("delete.txt");
    var textLoader:URLLoader = new URLLoader();
    textLoader.load(textRequest);
    textLoader.addEventListener(Event.COMPLETE,fileLoa ded);

    function fileLoaded(event:Event):void {
    text_field.text = event.target.data;
    text_field.wordWrap = true;
    }


    and my .txt:

    11 Gerroa Boat Club
    17 Dapto Bowls<br />18 Warilla Sporties
    24 Fri Mollymook Golfie%0D25 Kiama Leagues
    31 Fri Fraternity Club


    as you can see, I've tried both <br /> and %0D, but neither of them give me a single line break, they do nothing, and the single line breaks in the txt file give me two line spacings. I've tried setting HTML rendering both on and off for the dynamic text box.

    Any ideas?

    Cheers

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi BillyGoatKaraok,

    Welcome to FlashKit.

    If you use <br />, you'll have to have multiline and html text.
    code:

    text_field.multiline = true;
    text_field.htmlText = event.target.data;



    if you use %0D, you'll have to unescape the loaded data:
    code:

    text_field.text = unescape(event.target.data);


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