A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: How to add line feed in attribute?

  1. #1
    Senior Member
    Join Date
    May 2002
    Posts
    266
    I had searched the forum for "line feed" and read the 20 resuting threads but seems not able to find the answer. Amount them mostly are about white space which is not my problem.

    I also read how to include appropriate line feed in noteValue part. But I cannot find how to add a line feed in attribute.

    For example, I want an XML which data tag had 2 attributes which Title = artical title and Body = artical detail which is serveral of lines or ever serveral of paragraphs. I want to add line breaks in end of each paragraph but not success.

    I tried :
    1. normal "Return" in notepad : XML cannot load
    2. render as HTML and add < br> : XML cannot load
    3. \ n : no effect, the \ n shown in artical body

    Is there a way to add the line feed to attribute so that user can view/edit in the text box with multi paragragh but not 1 long bulky text.

    Thanks a lot for your help.

  2. #2
    Senior Member
    Join Date
    May 2002
    Posts
    266
    I am sorry that I forget to try & lt;br& gt; which work. It is quite enough for displaying (together with other tag in the same format) However, if let user edit the content, the Flash will insert many useless leading tag fonts tag and so >.< which almost double the original length.

    I know that it is hard, if not impossible to make all side perfect but If there is better ways I would most gladly like to know.

    Sorry for troubles and thanks for concerning

  3. #3
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    If you allow a Text Box of the Input type to support HTML - you'll get the extra tags.

  4. #4
    Senior Member
    Join Date
    May 2002
    Posts
    266
    But if I use plain input type, line break which save to the attributes of XML nodes will prevent the saved XML file from loading into flash again >.<

    maybe there is no two sharped sword in this issue....

    thanks for response

  5. #5
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    Huh??

    I can't understand what you're trying to do...

    Maybe some example code and a sample of the XML file...

  6. #6
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Well seeing we got a blast from the moderator guy about not showing enough code examples I thought I would cook something up for you:

    http://www.tupps.com/flash/examples/.../demoText.html

    Shows loading of the file:

    http://www.tupps.com/flash/examples/310660/demoText.xml

    It is pretty simple. The code was:

    stop();
    myXML = new XML();
    myXML.onLoad = DisplayData;
    myXML.load("demoText.xml");

    function DisplayData(success)
    {
    if (success) {
    xmlOutput = this.body.childNodes[0].nodeValue;
    }

    }

    Now it worked first shot. (download the XML to see its structure. Which made me wonder why you were having troubles, the thing I tried was that I use BBEdit (the ultimate text editor known to man kind imho) which can output text in a variety of different formats:

    Unix
    Mac
    Dos

    Now I have it set to Unix (both MacOS X and my Linux based web host use this). If I set BBEdit to save files as Mac format files they seem to come out screwy. However with either Unix or Dos format this works fine.

    Thanks

    Tupps



  7. #7
    Senior Member
    Join Date
    May 2002
    Posts
    266
    Thanks for your kind help.

    here is the thinggy I am doing

    http://www.logicplus.com.hk/LPFlashEx

    all the text there (except a few button label and logo) are from an XML file http://www./logicplus.com.hk/LPFlashEx/LPFlashEx.xml

    You can see from the right half was a dynamic text field with html enabled.

    For loading and displaying it is working ok with those & #10; & #09; etc.

    However, it cannot safe back to file and reread.
    If I save the XML object back, while other XML editor and browser can still edit the new copy of XML, Flash itself cannot.

    I see that it is becasue when it save back, all the & #10 etc and become real line feed and tab, which Flash cannot accept when reading back.

    So my original plan of letting user modify some field and save back cannot be done.

    Thanks all. I learnt much in this forum.

  8. #8
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Does the cgi script that you use to read the XML back to the server have the ability to run regular expressions.

    This would be an easy & quick fix.

    Thanks

    Luke

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