zone22
08-29-2003, 10:43 PM
Hi does anybody know how to make a flash movie that can online edit the xml files and also save it again on your website ? :rolleyes:
snapple
08-30-2003, 07:03 AM
zone22,
You edit XML files by using:
var keepCount = _root.XMLmenu.myXMLdoc.firstChild.childNodes.lengt h;
myNewDoc = _root.XMLmenu.myXMLdoc;
//define the node and NAME that node, in this case, USER_SITE, SITE_COMMENT, DATE - if you've used the example you'll see what i mean.
newNode = myNewDoc.createElement("USER_SITE");
//again here (i had three pieces of info)
newNodeTwo = myNewDoc.createElement("SITE_COMMENT");
//and here
newNodeThree = myNewDoc.createElement("DATE");
//here we actually fill in our newly created node with text, as you can see the end name is an input text field eg. comment, date
newtext = myNewDoc.createTextNode(_root.XMLmenu.control.comm ent);
newTextTwo = myNewDoc.createTextNode(_root.XMLmenu.control.date );
//decide where your going to put your node using append child
myNewDoc.firstChild.appendChild(newNode);
myNewDoc.firstChild.childNodes[keepCount].appendChild(newNodeTwo);
myNewDoc.firstChild.childNodes[keepCount].appendChild(newNodeThree);
myNewDoc.firstChild.childNodes[keepCount].childNodes[0].appendChild(newText);
myNewDoc.firstChild.childNodes[keepCount].childNodes[1].appendChild(newTextTwo);
myNewDoc.firstChild.childNodes[keepCount].attributes.url = _root.XMLmenu.control.address;
//these are just funtion i call to create the menu
_root.XMLmenu.createURLClip();
_root.XMLmenu.createDateClip();
_root.XMLmenu.listURL(myNewDoc);
_root.XMLmenu.listDate(myNewDoc);
This was the code (not optimised), i used for exactly the purpose you want, you can see it here:
http://www.uzi-lover.com/xml
But if youtry it out you will very soon realise that it does not perminantly update the XML doc, i think that this is only do-able with the combination of php and xml (one i'm working on now).
Unless i have a massive gap in my XML knowledge, either that or just built that fla wrong, lol :)
Kirupa, has a good tutorial on editing XML files in flash, also AS the definitive guide has a good reference section. But look on kirupa !!!
Basically use:
createElement
appendChild
createTextNode
appendChild
This is the link you want:
http://www.kirupa.com/developer/actionscript/create_edit_xml.htm
snapple :)
zone22
08-30-2003, 08:06 AM
HEy thnx this helps alot :p
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.