Copy link to clipboard
Copied
I have a local XML file referenced in my Declarations tag:
<fx:Declarations>
<fx:XML id="myXMLdata" source="assets/names.xml" />
</fx:Declarations>
I previously had a proof of concept version working with the XML defined in my MXML with a bindable tag:
[Bindable]
public var names : XML= <root>
etc., etc.
I need to place the xml in a separate local file so that changes to the file will persist.
How do I do this and bind to it?
thanks
MCE
Copy link to clipboard
Copied
This appears to be a Flex question. Please try posting your it to the Flex forums
http://forums.adobe.com/community/flex/flex_general_discussion
Copy link to clipboard
Copied
Could you please clarify which of the following you want to do
1. You have an (Actionscript)XML variable in a different file and want to bind to that.
2. You have XML inside a .xml file and want to bind to that
Thanks
balakrishnan v
Copy link to clipboard
Copied
Balakrishnan V,
I have XML inside a .xml file... that's what I want to bind to.
thanks,
MCE
Copy link to clipboard
Copied
http://www.adobe.com/devnet/air/flex/quickstart/xml_prefs.html - This should help you, i guess.
In short,
private function saveXML():void
{
personXML.firstName = fName_txti.text;
personXML.lastName = lName_txti.text;
var newXMLStr:String = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + personXML.toXMLString();
var fs:FileStream = new FileStream();
fs.open(file, FileMode.WRITE);
fs.writeUTFBytes(newXMLStr);
fs.close();
}
This function can be the eventHandler function for, say an XML change event etc.
Hope this helps,
Balakrishnan V