A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS 2 and xml line breaks

  1. #1
    Junior Member
    Join Date
    Aug 2008
    Posts
    5

    AS 2 and xml line breaks

    Hi,

    I have an xml image gallery that adds descriptive copy to each image.

    An example text string for one image is:

    <object source="images/p1.jpg" url="bigimages/pic01.jpg" title=" " description="Client:<br/>Brand:<br/>Objective:"/>

    What I’m trying to do is get the last part to look like this:

    Client:
    Brand:
    Objective:

    Why isn’t Flash recognizing the breaks I added to the xml file?

    Thanks in advance,
    D

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    use either a CDATA element or a linebreak tag in the file ( %# 10; -- remove the space)

    with cdata -
    PHP Code:
    /* in xml -
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <node1>
    <obj Src="images/p1.jpg" Url="bigimages/pic01.jpg" Title="Test">
    <![CDATA[Client:<br/>Brand:<br/>Objective:]]>></obj>
    </node1>
    </root>
    */

     // in Flash -
    _xml.onLoad = function(){
    rNodes = this.firstChild.childNodes;
    cNodes = rNodes[0].firstChild;
    sTitle = cNodes.attributes['Title'];
    sDesc = cNodes.firstChild.nodeValue;
    aText.html = true;
    aText.htmlText = sTitle+"<br><br>";
    aText.htmlText += sDesc;
    }
    with linebreak tag -
    PHP Code:
    /* in xml -
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <node1>
    <object source="images/p1.jpg" url="bigimages/pic01.jpg" title="Test" 
    description="Client:&# 10;Brand:&# 10;Objective:"/>
    </node1>
    </root>
    */

    // in Flash -
    _xml.onLoad = function(){
    rNodes = this.firstChild.childNodes;
    cNodes = rNodes[0].firstChild.attributes;
    sTitle = cNodes.title;
    sDesc = cNodes.description;
    aText.html = true;
    aText.htmlText = sTitle+"<br><br>";
    aText.htmlText += sDesc;
    }

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