• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

how to bind to local xml file?

New Here ,
Aug 10, 2010 Aug 10, 2010

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

Views

526

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 10, 2010 Aug 10, 2010

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 10, 2010 Aug 10, 2010

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 11, 2010 Aug 11, 2010

Copy link to clipboard

Copied

Balakrishnan V,

I have XML inside a .xml file... that's what I want to bind to.

thanks,

MCE

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 11, 2010 Aug 11, 2010

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines