code_junkie

having trouble with insertChildBefore and insertChildAfter in AS3

Nov 11th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. var xml:XML = new XML(<rootNode>
  2. <head>
  3. <meta name="template" content="Default" />
  4. </head>
  5. <mainSection>
  6. <itemList>
  7. <item>
  8. <video src={this.videoURL} />
  9. <img src={this.src}></img>
  10. </item>
  11. </itemList>
  12. </mainSection>
  13. </rootNode>);
  14.  
  15. var newNode:XMLList = new XMLList("<item><video src="" + _videoSource + ""></video></item>");
  16.  
  17. var contentNode:XML = new XML(xml.mainSection.itemList.item);
  18. xml.insertChildBefore(contentNode ,newNode)
  19.  
  20. var contentNode:XML = xml.mainSection.itemList.item[0];
  21. var parentNode:XML = xml.mainSection.itemList[0];
  22. parentNode.insertChildBefore( contentNode, newNode[0] );
Add Comment
Please, Sign In to add comment