Copy link to clipboard
Copied
This is first time I'm trying to write in XML, so I'm sorry if this is a simple question. I have a textbox on the field which will be used for entering names, and I created XML tags using
var objs:XML = new XML( <objects /> );
var objname:XML = new XML ( <objectname /> );
objs.appendChild( objname); // add the <name> node to <objects>
I hope to have a XML structure of
<object>
<objectname>james</objectname>
<objectname>jennice</objectname>
<object/>
But I do not know how to write from textbox in flash to the xml file, or dynamicly create a xml from as3. Please help, thanks in advance.
Copy link to clipboard
Copied
use something like:
var objs:XML = new XML( <objects /> );
function addNameF():void{
var objname:XML = new XML ( <objectname /> );
objs.appendChild( objname); // add the <name> node to <objects>
objname.nodeValue = yourtextfield.text;
}
Copy link to clipboard
Copied
But I do not know how to write from textbox in flash to the xml file, or dynamicly create a xml from as3.
Flash alone can`t write to a users (or your own) filesystem you will need to look into AIR (publish your flash to AIR for Desktop to have access to the Filesystem). If you want the user allow to write a xml file serverside you will want to make use of a technology like php or asp in combination with flash.
Copy link to clipboard
Copied
(that's not true: check the FileReference class'es save method.)
Copy link to clipboard
Copied
You`re right, that fact has somehow escaped me.
Copy link to clipboard
Copied
(the save method wasn't available when the filereference class was first introduced. it was quietly added later and i didn't find out about it until i posted a message similar to your's and someone else corrected me.)
Find more inspiration, events, and resources on the new Adobe Community
Explore Now