Undefined could mean that the var doc is not in scope or never assigned.
1. I created a new Flash Movie in Flash 8. Should work in MX 2004
2. On frame one I pasted the code
var doc:XML = new XML("<root></root>");
var item:XMLNode = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 1") );
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 2") );
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 3") );
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 4") );
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 5") );
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 6") );
doc.firstChild.appendChild(item);
trace (doc);
3. Control->Test Movie display in output:
<root><item>Item 1</item><item>Item 2</item><item>Item 3</item><item>Item
4</item><item>Item 5</item><item>Item 6</item></root>
You could also do this and get same results:
myXml_str = "<root><item>Item 1</item><item>Item 2</item><item>Item
3</item><item>Item 4</item><item>Item 5</item><item>Item 6</item></root>";
var doc:XML = new XML(myXml_str);
trace (doc);
--
Lon Hosford
www.lonhosford.com May many happy bits flow your way!
[quoted text, click to view] "FlashCuriouz" <webforumsuser@macromedia.com> wrote in message
news:dnmhpv$ktm$1@forums.macromedia.com...
This traces undefined for me. What am I missing?