flash读取asp输出的值出错问题。高手进!

来源:百度知道 编辑:UC知道 时间:2024/05/28 10:03:01
<!--#include file="cn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from ctadcontent",conn,1,1
if not rs.eof then
for i=1 to rs.recordcount-1
tcLink=tcLink&""""&rs("link")&""""&","
rs.movenext()
next
tcLink=tcLink&""""&rs("link")&""""
end if
response.write ("flashLink="&tcLink&"")
rs.close
conn.close
set rs=nothing
set conn=nothing
%>
asp输出结果。flashLink="1111.swf","2222.swf"

as代码接收asp的值,我想让flash随机数据库记录的swf文件。
_root.link.text = newload.flashLink;
filename=[newload.flashLink]; <--这里出问题。
path = "";
i=filename.length;
k=Math.floor(Math.random()*i);
loadMovie(path+filename[k],"loadpic");

我用filename=["111.s

我说的很清楚了,我也请教过高手,flash里数组直接载入进来的值是无法应用的!!!我也确实遇到过类似的问题.不信拉倒!

首先我遗憾的告诉你,如果你想在flash里用数组直接填写载入进来的值是无法实现的.推荐你在asp生成xml格式.

你用的filename=[]书写方法是flash6.0以前的书写格式,as2.0应该是var filename:Array = new Array()

//你的问题我也曾经遇到过,在网上查了很多资料是不能象你那样做的.
你必须在asp声明多个变量:
&flashLink1=1111.swf&flashLink2=2222.swf&
下面是正确载入外部文本的方法(变量名你自己改吧):

//防止乱码
System.useCodepage = true;
//创建一个实例
var _text = new LoadVars();
_text.onLoad = function(success) {
if (success) {
var mingzi:Array = new Array(_text.Name1, _text.Name2, _text.Name3, _text.Name4, _text.Name5, _text.Name6, _text.Name7, _text.Name8, _text.Name9, _text.Name10);
} else {
Load.loadText.text = "数据加载失败!";
}
};
_text.load("***.asp");我我

确切地说..flash是不可以直接与数据库连接的.只能是通过ASP(也可以是其他的PHP/JSP等);
所以呢.首先,先在ASP里编写好连接数据库的语句

<%
dim cn
dim connstr
dim db
db="asp.mdb"