[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Flash XML variable appending or combining

Posted on 2007-10-06
2
Medium Priority
?
637 Views
Last Modified: 2008-01-09
Say I have the following XML output

<?xml version="1.0"?>
<root>
      <chat>
            <message id="14518">
                  <date>2007-10-06 17:26:33</date>
                  <from>Anonymous</from>
                  <to>ALL</to>
                  <text>test message</text>
            </message>
      </chat>
</root>

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"?>
<root>
      <chat>
            <message id="14519">
                  <date>2007-10-06 17:27:48</date>
                  <from>Anonymous</from>
                  <to>ALL</to>
                  <text>New Message at 5:27 test</text>
            </message>
      </chat>
</root>

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
newID= tempXML.chat.message.@id
to add
tempXML.chat.message.(@id==newID) to chatXML.chat

Thanks for the help!!
0
Comment
Question by:dban00b
2 Comments
 
LVL 14

Accepted Solution

by:
tomaugerdotcom earned 2000 total points
ID: 20029863
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 chatXML.chat.appendChild (tempXML.chat.message)?
0
 
LVL 1

Author Comment

by:dban00b
ID: 20030456
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

Thanks!!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses
Course of the Month18 days, 23 hours left to enroll

834 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