Im not 100% sure, but I don't believe flex can write to the server directly. 
You will most likely have to employ a server side http service to achieve this.

Also if you are going to be storing sensitive info in an xml file, you should 
encrypt the passwords and security answers

________________________________
From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of anuj181
Sent: Tuesday, 16 December 2008 1:37 p.m.
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How would I Overwrite contents of External XML File


Hi All
I am working on change password option for the user, I am reading
password content from external XML Files and then depending upon the
added value I need to overwrite the external XML's files passsword
entry. I am using following code for changing it but it is not
working, My XML file is in the external folder but withtin the same
project and this is one of the component which i am calling on click
of some button. I need to overwrite data in Login.xml which is stored
in Private folder as the separate folder in my project, Reading from
thh xml file is no problem but writing back is an issue,
Does anyone know where I am screwing things up?

Many Many Thanks for your help
Anuj
//My XML
<?xml version="1.0" encoding="utf-8"?>
<Users>
<user>
<id>1</id>
<userName>asasasd</userName>
<password>asasd123</password>
<securityQuestion>Test Security Question</securityQuestion>
<answerSecurityQuestion></answerSecurityQuestion>
</user>
</Users>

/********************CODE*******************/

<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";
creationComplete="init();"
horizontalScrollPolicy="off" verticalScrollPolicy="off">
public function init():void
{
var getPassword:URLRequest=new URLRequest("Private/Login.xml");
passwordLoader = new URLLoader();

try
{
passwordLoader.load(getPassword);
}
catch (error:SecurityError)
{
trace("SecurityError has occurred while loading password");
}

passwordLoader.addEventListener(Event.COMPLETE,getAlreadySetPassword);
}

//ChangePassword

public function changePassword(evt:MouseEvent):void
{
if((txt_Enter_Password.text=="")||(txt_ReEnter_Password.text=="")||
(txt_Security_Question.text=="")||(txt_Security_Answer.text==""))
{
Alert.show("Please Check the values entered. They cannot be
null");
}
else if(txt_Enter_Password.text!=txt_ReEnter_Password.text)
{
Alert.show("Passwords do not match");
}
else
{
externalXMLPassword.user.password=txt_Enter_Password.text;

externalXMLPassword.user.securityQuestion=txt_Security_Question.text;

externalXMLPassword.user.answerSecurityQuestion=txt_Security_Answer.text;

}
}

<mx:Button x="630" y="402" label="Save" click="changePassword(event);"/>

Reply via email to