So, I have a flash application that handles several client profiles for a company. Whenever a new client profile is created, it saves a new XML file localy. My problem is that instead of doing a "silent" file creation, a window pops up just like doing a "Save As" as to confirm that the file is being saved on disk and which name should it be.
所以,我有一个Flash应用程序,可以处理公司的几个客户端配置文件。每当创建新的客户端配置文件时,它都会保存一个新的XML文件。我的问题是,不是执行“静默”文件创建,而是弹出一个窗口,就像执行“另存为”一样,以确认文件正在保存在磁盘上以及应该是哪个名称。
Is there a way to do a file save within flash without it calling out that window? If so, would it be possible to link me to an example of it?
有没有办法在闪存中执行文件保存而不调用该窗口?如果是这样,是否可以将我链接到一个例子?
Here is an example of my code:
以下是我的代码示例:
var xmltosave:XML = new XML ( "<?xml version="1.0" encoding="utf-8"?><cliente><id>"+idfield.text+"</id><nome>"+nomefield.text+"</nome><tipo>"+tipofield.text+"</tipo><empresa></empresa><email>"+emailfield.text+"</email><contacto>"+contacto1field.text+"</contacto><contacto2>"+contacto2field.text+"</contacto2><profissao></profissao><datainscricao>"+datafield.text+"</datainscricao><dataalteracao></dataalteracao><notas></notas><notas2></notas2><notas3></notas3></cliente>");
var file:FileReference = new FileReference;
var filepath:String = new String(idfield.text + ".xml");
file.save( xmltosave, filepath );
Also, I know that the xmltosave is very long, is it possible to do line breaks in AS3 code?
另外,我知道xmltosave很长,是否可以在AS3代码中进行换行?
Thank you. Marco Roberto.
谢谢。马可罗伯托。
NOTE: I know that I should use a php script to manage files, but unless that php is able to run locally without any server installs, like XAMPP, im not interested in using it. This is a small project and I just need to handle XML files. Unless its absolutely impossible to do it without PHP scripts, I would prefer a AS3 solution.
注意:我知道我应该使用php脚本来管理文件,但除非php能够在没有任何服务器安装的情况下在本地运行,例如XAMPP,我对使用它不感兴趣。这是一个小项目,我只需要处理XML文件。除非没有PHP脚本绝对不可能,否则我更喜欢AS3解决方案。
1 个解决方案
#1
1
since you're building a desktop application you can use flash.filesystem.File, which is part of the AIR SDK, to save files as a background process.
因为您正在构建桌面应用程序,所以可以使用flash.filesystem.File(它是AIR SDK的一部分)来将文件保存为后台进程。
#1
1
since you're building a desktop application you can use flash.filesystem.File, which is part of the AIR SDK, to save files as a background process.
因为您正在构建桌面应用程序,所以可以使用flash.filesystem.File(它是AIR SDK的一部分)来将文件保存为后台进程。