PDA

View Full Version : Create a xml file on the disk


Dosty
09-22-2005, 02:51 PM
Hi, I'm trying to allow to my flash application user's to create a xml file on their disk with the support of a simple script aspx. The script I'm sure it works because if I call it with the browser with the right parameters it creates the file, but if I call it from the movie it doesn't work. The code is

fileExtension = ".xml";
fileFolder = "Files";
saveSeparator = "\\";
loadSeparator = "/";
var File = new XML(XML);
File.xmlDecl = "<?xml version=\"1.0\" ?>";
var resultXML = new XML();
resultXML.ignoreWhite = true;
resultXML.onLoad = verifySave;
var URL = "http://localhost/";
URL += "saveFile.aspx?filename=";
URL += escape(fileFolder + saveSeperator + filename + fileExtension);
File.sendAndLoad(URL,resultXML);
verifySave = function(save_success) {
if (save_success) {
var server_error = this.firstChild.firstChild.firstChild.nodeValue;
switch (server_error) {
case "none":
canvas.openErrorPopUp("File saved successfully.");
break;
case null:
case "":
case "error":
default:
canvas.openErrorPopUp("Error saving file.\nFile not saved.");
break;
case "exists":
canvas.openErrorPopUp("File already exists\nwith that name.\nTry a different\nfile name.");
break;
}
} else {
canvas.openErrorPopUp("Error saving file.\nFile not saved.");
}
}

Any suggests? Thank u, bye!

Morg
09-22-2005, 03:40 PM
You can only use URL += "saveFile.aspx?filename="; in the browser.

As soon as you start passing variables to a URL, it has to run in the browser... Maybe look into using a 3rd party tool.. like Flash Jester or something. It could solve your problem.

Dosty
09-22-2005, 06:28 PM
So, you said that it's impossible pass variables to a URL that doesn't run in the browser, right? Sorry, but I don't know Flash Jester, where can I download it?Is it free? Does it work whith flash mx 2004?
Thanks for the help!

Morg
09-23-2005, 07:07 AM
http://www.flashjester.com/

Dont think its free, but I dont think its expensive either... Theres a trial download, I think...

madgett
10-08-2005, 04:15 AM
Another one is MDM Zinc: http://www.multidmedia.com. That one's more expensive but it's 100 times better for larger projects.