新手上路
入门动画
高级创作
 
总体导航图
学习指南
当前位置:多媒体应用基础>>多媒体创作工具>>FLASH专区>>高级创作>>结合ASP制作留言板(三)
高级创作
结合ASP制作留言板(三)

二、 Flash动画中的操作部分

读取数据的帧中的代码为:

br> Set Variable: "eof" = "false"
Set Variable: "total" = 0
Set Variable: "added" = 0
Set Variable: "sub" = ""
Set Variable: "name" = ""
Set Variable: "text" = ""
Set Variable: "backmethod" = 0//先初始化数据
Set Variable: "r" = Random (65500)//产生随机数

Load Variables ("http://www.yourhost.com/guest.asp?action="& r, "")//通过随机参数调用程序

Set Variable: "temp" = "正在读取信息中……"

直到读完文件,不然总是返回 read帧去显示“正在读取信息中……”。如果读取完成,也就是“eof eq "true"”了的话,执行下面一个关键语句。

If (eof ne "true")
Go to and Play ("read")
End If
Set Variable: "total" = Substring ( total, 0, Length ( total ) - 2 )

通过上面的语句把取得的 total 值截去了两个字节

在下一个帧中输入如下代码:

Set Variable: "temp" = "信息读取完成,共有信息条目数:"& total
Stop

这样一个留言板的旧数据就读取完毕了。

另外加一个“添加”按钮,其代码如下:

If ((sub eq "") or (name eq "") or (text eq ""))
 Go to and Play ("error")
Else
 Set Variable: "temp" = "正在向服务器添加数据……"
 
 Load Variables ("url?action=add", "", vars=POST)//url是asp文件的路径
 Go to and Play ("wait2")
End If

If (added <> 1)
Go to and Play ("wait2")
End If

Set Variable: "temp" = "数据成功写入!"
Stop

这样,一个留言板的功能就实现了,至于flash动画中的具体实现请读者利用前面学过的知识来制作。

上一页     下一个知识点
¨flash编程基础¨ ¨精确下载制作¨ ¨制作音乐开关按钮¨ ¨洋葱皮效果¨
¨制作动画控制面板¨ ¨结合asp制作留言板¨ ¨用Generator作后台数据库¨ ¨使用新技术xml¨