|
主题: 用Flash创建XML文件.
|
 |危险|
职务:普通成员
等级:1
金币:11.0
发贴:248
注册:2004/10/12 18:02:52
|
#12001/8/9 19:10:24
下面这段代码可以在本地硬盘创建一个XML文件,值得推广! yourxmlobj.toString() FSCommand("save","filename.xml")
|
 手工感情
职务:普通成员
等级:3
金币:10.0
发贴:556
注册:2001/1/3 2:50:20
|
#22001/8/9 19:31:37
xml的主要应用是在web上的,在本地创建没有什么实际的意义 还是用xmlsocket和远程机器创建连接做一些应用为好
黑色的风略过我的翅膀,我却无法落下来梳理你的羽毛 ———————————————— ◆5d.cn互动论坛◆ ------|xml版主|------
|
 |危险|
职务:普通成员
等级:1
金币:11.0
发贴:248
注册:2004/10/12 18:02:52
|
#32001/8/9 19:57:15
那么这个呢? mystring=yourxmlobj.toString() loadVariablesNum("myscript.php?data="+mystring+"&filename=tester.xml",0)
|
 手工感情
职务:普通成员
等级:3
金币:10.0
发贴:556
注册:2001/1/3 2:50:20
|
#42001/8/9 22:24:14
不错
黑色的风略过我的翅膀,我却无法落下来梳理你的羽毛 ———————————————— ◆5d.cn互动论坛◆ ------|xml版主|------
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
注册:2000/9/15 13:56:49
|
#52001/8/10 9:52:59
danger在上个贴子中说 引用: 下面这段代码可以在本地硬盘创建一个XML文件,值得推广! yourxmlobj.toString() FSCommand("save","filename.xml")
这段代码肯定不能写入。。。 除非使用js的语法用filesys来写入。也就是说只能通过html形式来做。
|
 |危险|
职务:普通成员
等级:1
金币:11.0
发贴:248
注册:2004/10/12 18:02:52
|
#62001/8/11 11:16:04
画魔在上个帖子中说 引用: danger在上个贴子中说 引用: 下面这段代码可以在本地硬盘创建一个XML文件,值得推广! yourxmlobj.toString() FSCommand("save","filename.xml")
这段代码肯定不能写入。。。 除非使用js的语法用filesys来写入。也就是说只能通过html形式来做。
不信你就自己试试!
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
注册:2000/9/15 13:56:49
|
#72001/8/11 11:56:47
恕我无知,在我的flash概念里面,fscommand没有这种方法的 而且试的结果也是什么都没发生.
|
 |危险|
职务:普通成员
等级:1
金币:11.0
发贴:248
注册:2004/10/12 18:02:52
|
#82001/8/11 12:29:54
yourxmlobj.toString() FSCommand("save","filename.xml")
将上面这段代码复制到mainframe的第一帧中,发布成swf,然后在硬盘上点击运行!
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
注册:2000/9/15 13:56:49
|
#92001/8/12 2:59:13
谁实现了可以告诉我,我抱着不可能的想法试了一下,失败。 fscommnd本身就是外部命令,而且固定方法只有几个,是不可能写出xml文本的。
|
 |危险|
职务:普通成员
等级:1
金币:11.0
发贴:248
注册:2004/10/12 18:02:52
|
#102001/8/12 8:55:51
在本人机器上确实实现了。Actionscripts:
Saving XML to a file when used locally
Saving xml to a file when used locally can be done in two ways, the first is this: Cookie.setCookie(xmlobj) and the second way is this:
yourxmlobj.toString() FSCommand("save","filename.xml")
if you want this for use over the web then none of the above can be used, instead you will have to use a server-side script to create an xml file on your webserver, i would recommend either perl or php. The way i do it is this, i allow peopole to edit the xml structure inside of flash, then when they are done, they click save and then xml object is converted to a string: mystring=yourxmlobj.toString()
loadVariablesNum("myscript.php?data="+mystring+"&filename=tester.xml",0) then i send the string to a php script: then php script then creates an xml file called tester.xml or whatever i tell it to and it then inserts the xmlstring into the newly created xml file. Voila! Remember xml is basically just formatted text, i can post the php script here if you like its only small, or if you prefer i can post a perl script(cgi). Either way suits me, its up to you, note you will need a cgi-bin on your server to run a cgi-script and a php module installed on your server to run a php script, so find out if you have that first!
From actionscripts.org
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
注册:2000/9/15 13:56:49
|
#112001/8/13 9:50:15
note you will need a cgi-bin on your server to run a cgi-script and a php module installed on your server to run a php script, so find out if you have that first!
看看最后一句比较概括,他做得更没什么特色,还得靠cgi或者php写xml文档 他用后台先读过来xxxxx.xml然后修改了以后可以向服务器发送命令字符(fscommand)接着,才在服务器内写入了xml文档。
|
 |危险|
职务:普通成员
等级:1
金币:11.0
发贴:248
注册:2004/10/12 18:02:52
|
#122001/8/13 11:24:19
但是上面那段代码确实可以在本地创建文件.你没有试成功吗? yourxmlobj.toString() FSCommand("save","filename.xml")
|
 pino
职务:普通成员
等级:1
金币:0.0
发贴:48
注册:2001/5/14 17:44:25
|
#132001/8/13 12:25:52
save 命令只对flash player有用,在浏览器里面无效
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
注册:2000/9/15 13:56:49
|
#142001/8/13 15:41:29
pino在上个帖子中说 引用: save 命令只对flash player有用,在浏览器里面无效
and the version must be Flash Player 5.0 r30 above.
|
 |危险|
职务:普通成员
等级:1
金币:11.0
发贴:248
注册:2004/10/12 18:02:52
|
#152001/8/13 17:22:06
对,说话要注意严密!
|