Flash XML variable appending or combining

Posted on 2007-10-06
Last Modified: 2008-01-09
Say I have the following XML output

<?xml version="1.0"?>
            <message id="14518">
                  <date>2007-10-06 17:26:33</date>
                  <text>test message</text>

And I load it up into my Flash variable chatXML:XML;
Which works fine, Now a new message has been added to the chatrrom

<?xml version="1.0"?>
            <message id="14519">
                  <date>2007-10-06 17:27:48</date>
                  <text>New Message at 5:27 test</text>

Presently I can reload my chatXML variable with the new outpput and add the new message to the display.
Is there a way I can combine the two XML outputs into one variable to retain the old information?  And also rather than making my XML output produce all messages each go for a lot of wasted redundancy.

I'm thinking that maybe I could do something like use a new var tempXML and somehow use
to add to

Thanks for the help!!
Question by:dban00b
    LVL 14

    Accepted Solution

    How is the XML coming into flash? Are you receiving discrete XML blocks in separate requests the way you have written them here in the example code you provided, or is it all one file? I mean, when a new chat message is sent, is it in an XML stream all by itself, or are you re-sending all the chat messages that came before it as well?

    Have you tried (
    LVL 1

    Author Comment

    Each call to the XML output only gives what is new since the last call.
    The appendChild() function worked exactly like I wanted, it even worked in a for-each loop to append all the messages found in tempXML to chatXML


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
    There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
    In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
    The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now