A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How to do a line break in XML?

  1. #1
    Member
    Join Date
    Nov 2005
    Posts
    94

    How to do a line break in XML?

    Hello everybody.

    I have a piece of code were text is loaded into flash but I don't know how to create a line break in XML and that is actually shows in the flash movieclip.

    this is what I have in XML
    <name>FIRST LINE
    SECOND LINE
    </name>


    But the line brake space appears in flash double, like this:
    FISR LINE

    SECOND LINE


    But his how i want it to appear in Flash:
    FIRST LINE
    SECOND LINE

    Anyone?

    Thanks in advance

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    PHP Code:
    _xml = new XML();
    _xml.ignoreWhite = true;
    _xml.load("test.xml");

    /*--test.xml--
    <?xml version="1.0"?>
    <name>FIRST LINE
    SECOND LINE</name>
    */

    _xml.onLoad = function(){
    str = this.firstChild.childNodes.toString();
    str = str.split("\r\n").join("\r");
    my_txt.text = str;
    };
    hth

  3. #3
    Junior Member
    Join Date
    Oct 2008
    Location
    London
    Posts
    2

    Wink simple solution

    Simply use &#xD; in your XML document wherever you want to have the linebreaks.

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