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(); |
it doesn’t work for me…
can u explain more for me?
tq
Which version of Air you are using?
It works perfect when i export it from flash. but its doesnt works when I run the swf or publish it as windows projector (.exe) from publish settings. Does oit works only
Do you mind if I quote a few of your posts as long as I provide credit
and sources back to your site? My website is in the very same
area of interest as yours and my visitors would really benefit
from some of the information you present here. Please let me know if this okay with you.
Thank you!