• 【设为首页】
  • 【收藏闪客居】
当前位置:主页>FLASH AS 编程>flash和WEB程序应用>文章内容
  • flash向asp提交信息
  • 来源:网络 作者:网络 2006-12-30 【


做的是个填写留言的页面,这里分asp和flash两个部分!
一,asp(write.asp)部分
write.asp内容:
程序代码

<%@ LANGUAGE="VBscript" codepage="936"%>
<%
Function IDMaker
Dim ID
Randomize
ID=Replace(Year(Now)&Month(Now)&Day(Now)&Time,"-","")
ID=Replace(ID,":","")
ID=Replace(ID," ","")
ID=Replace(ID,"-","")
ID=Replace(ID,"/","")
ID=Replace(ID,"\","")
ID=Replace(ID,"上午","")
ID=Replace(ID,"下午","")
ID=Replace(ID,"PM","")
ID=Replace(ID,"AM","")
IDMaker=ID&cstr(Int(999999999*Rnd))
End Function


DataBaseName="db1.mdb"
    
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath(DataBaseName)
    sub Closedb
    Conn.Close
    set Conn=Nothing
    end sub
    set rs=server.CreateObject("Adodb.recordset")
    rs.open "Select top 1 * from Message",conn,2,3
    rs.addnew
    rs("ID")=IDMaker
    rs("Name")=request.Form("myName")
    rs("Email")=request.Form("myEmail")
    rs("QQ")=request.Form("myQQ")
    rs("Title")=request.Form("myTitle")
    rs("Content")=request.Form("myContent")
    rs("Addtime")=now
    rs.update
    rs.close
    set rs=nothing
    call Closedb
%>


以上是为flash和asp交互用的,上面的代码有些理解不了,有些看的懂,也解释不清楚,自己明白就行了,asp太菜没办法!

二.接下来是flash部分:

程序代码

System.useCodepage = true;//设置支持中文显示
this_mc._visible = false;//this_mc这个剪辑初始隐藏(this_mc是用了做错误提示用的)
function clean() {
    this_name.text = "";
    this_email.text = "";
    this_qq.text = "";
    this_title.text = "";
    this_content.text = "";//以上代表返回清除各个文本值,设置了初始值为空!
}
clean_btn.onRelease = function() {//定义取消按纽(clean_btn)的函数
    clean();
};
send_btn.onRelease = function() {//发送留言按纽函数
    if (this_name.text == "") {//如果名字为空
        this_mc._visible = true;//那么this.mc可见
        this_mc.tishi.text = "你还没告诉我名字!";
        //并且tishi.txt动态文本提示信息:姓名不能为空!
    } else if (this_title.text == "") {
        this_mc._visible = true;
        this_mc.tishi.text = "总要有个话题吧!";
        //上面三行解释为:如果剪辑title为空,那么跳出提示:主题不为空!
    } else if (this_content.text == "") {
        this_mc._visible = true;
        this_mc.tishi.text = "你没有话和我说吗?";
        //上面三行解释为:如果剪辑content为空,那么跳出提示:内容不为空!
    } else {
        myName = this_name.text;
        myEmail = this_email.text;
        myQQ = this_qq.text;
        myTitle = this_title.text;
        myContent = this_content.text;
        trace(myName);
        trace(myEmail);
        trace(myQQ);
        trace(myTitle);
        trace(myContent);
        //重点解释:trace表示输出()内各个定义的值!
        loadVariablesNum("mystend.asp", 0, "POST");
        //载入write.asp的asp页面
        _parent.page_num = 1;
        _parent.prev_btn._visible = false;
        _parent.txt._visible = true;
        _parent.xiala._visible = true;
        _parent.next_btn._visible = true;
        _parent.btn2.gotoAndStop(1);
        _parent.btn1.gotoAndStop(2);
        _parent.ggg = 0;
        _parent.mess.unloadMovie();
        _parent.mess.loadMovie("read.swf");
    }
};
stop();



上一篇:FLASH与ASP通信原理入门   下一篇:Flash处理XML文档数据教程
  • 用户名:新注册) 密码: 匿名评论
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规)
推荐内容

Copyright © 2006-2008 flashas.net All Rights Reserved.
网站内容咨询: admin#flashas.net (#为@) 联系QQ:40777822 浙ICP备06033001号
(本网站最佳浏览解析度为1024*768, 建议使用IE 6.0或以上版本浏览器。)