SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru JoePrice's Avatar
    Join Date
    Jan 2002
    Location
    UK
    Posts
    673
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Formatting text read into flash by XML

    Alrite guys.

    I've got a general question about reading in XML. Say i read in a couple of paragraphs of text from XML into flash.... I want to format that text, for example:

    Bolden headings
    use italics
    create paragraph breaks
    change font colour

    Now how would I go about doing that? if i start adding tags like <b></b> into my xml file that will cause the xml file to keel over because flash parses the<b></b> tag to be a content tag.....

    So how does one format text read into flash via xml?

    Any suggestions would be most appreciated

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A couple of options, one you could format your xml document a little more organized like for instance.

    Code:
    <item>
    <heading id="heading1">
    I am a heading
    </heading>
    <para id="para1">
    Paragraph 1 text
    </para>
    
    <para id="para2">
    Paragraph 2 text
    </para>
    </item>

    Etc....

    And then you could format each item. Or you can do it this way by using CDATA in your xml document which will allow you to put html tags in your XML nodes. Flash will not choke on this.
    Code:
    <item>
    <![CDATA[I am some text with <b> html tags </b> in it, by using CDATA <i>the xml parser will ignore me</i>.
    ]]>
    </item>
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Guru JoePrice's Avatar
    Join Date
    Jan 2002
    Location
    UK
    Posts
    673
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Freddy, you da man....

    Many thanks for your helpful suggestions.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •