This article shows how to create XML and store it into a Local Machine without any dialog box.
In order to avoid the dialog box and save with full security, Adobe Air is the best option. FileStream from Adobe Air has the reliability to save the file without any user interaction
Step 1. Create one Sample XML file in C:\test.xml with <sample></sample>
Step 2: Create two textboxes and one save button with instances name uid , pwd and saveBtn
Step 3. The code below
import flash.filesystem.*; var LoadXML=new URLLoader(new URLRequest(“c://test.xml”)) // Loading XML file LoadXML.addEventListener(Event.COMPLETE,LoadXMLFunction) // on load of XML calls LoadXMLFunction saveBtn.addEventListener(MouseEvent.CLICK,onSave) // on save button click calls onSave var MainXML:XML;function LoadXMLFunction(e:Event) { MainXML=XML(e.target.data) //Load all XML data from test.xml to MainXML trace(MainXML) } function onSave(e:Event):void { var item:XML = <citem /> // Create one XML Node item.userId = uid.text // assign uid textbox value to userId node item.pwd = pwd.text // assign pwd textbox value to pwd node MainXML.appendChild(item); // Append this xml item to MainXML var file:File = new File(); |