我在这个过程中相当新,所以请耐心等待......我的目标是通过asp从数据库获取数据,然后从flash中获取asp数据。一切都在db / asp方面正常工作,我的问题是让这些数据在flash中正确显示(在这种情况下,我有一个可变背景,我想从.asp中拉出一个字符串“background.jpg”)。我的代码:
FLASH:
var loader : URLLoader = new URLLoader;
var theText:TextField = new TextField();
addChild(theText);
loader.addEventListener(Event.COMPLETE,completeF);
var urlreq:URLRequest = new URLRequest("index.asp");
var urlvars: URLVariables = new URLVariables;
urlreq.data=urlvars
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
urlreq.method = URLRequestMethod.POST;
loader.load(urlreq);
function completeF(e:Event):void{
trace("Hello",urlvars.background);
trace(loader.data);
}
ASP:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/DustinsDB.asp" -->
<%
Dim rs1__MMColParam
rs1__MMColParam = "1"
If (Request.QueryString("courseNum") <> "") Then
rs1__MMColParam = Request.QueryString("courseNum")
End If
Dim rs1,rs1_cmd,rs1_numRows,background,grid
Set rs1_cmd = Server.CreateObject ("ADODB.Command")
rs1_cmd.ActiveConnection = MM_DustinsDB_STRING
rs1_cmd.CommandText = "SELECT * FROM NAMES WHERE courseNum = ?"
rs1_cmd.Prepared = true
rs1_cmd.Parameters.Append rs1_cmd.CreateParameter("param1", 5, 1, -1, rs1__MMColParam) ' adDouble
Set rs1 = rs1_cmd.Execute
rs1_numRows = 0
background = rs1.Fields.Item("background").Value
grid = rs1.Fields.Item("grid").Value
response.write("&background="&background)
rs1.Close()
Set rs1 = Nothing
%>
我曾尝试做一些研究,但我不确定我做错了什么,我认为我设置我的.asp页面不正确,因为当我跟踪loader.data我得到这个大的长字符串,结果证明是所有的代码来自.asp页面:
背景=%22安培;%3CLANGUAGE =%22VBSCRIPT%22%20CODEPAGE%3D%2265001%22%0D 0A%3C%%21%2D%2D%...
所以它加载.asp页面而不是我想要的变量,那么如何才能将其修复为仅显示respose.write部分?任何帮助将不胜感激。谢谢!