I have an XML document:
var xml:XML = new XML(<rootNode>
<head>
<meta name="template" content="Default" />
</head>
<mainSection>
<itemList>
<item>
<video src={this.videoURL} />
<img src={this.src}></img>
</item>
</itemList>
</mainSection>
</rootNode>);
What I would like to do is when I need certain conditions, insert another at the beginning of the itemList.
var newNode:XMLList = new XMLList("<item><video src=\"" + _videoSource + "\"></video></item>");
I can generate and track newNode just fine, but whenever I try to add it with insertChildBefore, it always returns undefined.
var contentNode:XML = new XML(xml.mainSection.itemList.item);
xml.insertChildBefore(contentNode ,newNode)
contentNodealways excellent, but when trying insertChildBeforeor insertChildAfterhe always fails. It is strange if I make it contentNodeless specific (e.g. xml.mainSection), then it works as expected.
Thanks for any help, it drives me crazy!
source
share