您的位置:程序门 -> 多媒体/设计/flash/silverlight 开发 -> flash流媒体开发



flash如何获取数据?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


flash如何获取数据?
发表于:2007-01-24 08:39:54 楼主
在论坛里找了半天关于flash连接数据库获取数据的帖子,但一个完整的都看不到
都说的一知半解,loadvariables( "webform3.aspx ", " ", "post ");或者又说用xml来读取,但都没有代码,说的也不清楚

有没有哪位兄弟可以给端源码来研究研究
我想做的是flash连access数据库,用asp和。net都可以,loadvariables和xml都行
最关键的是能给段代码,就是flash知道读到asp或aspx里的数据的那部分的
发表于:2007-01-24 09:02:361楼 得分:0
没有人会吗??????
发表于:2007-01-24 11:44:212楼 得分:0
var   lxsingname_array:array=new   array();
var   lxsinger_array:array=new   array();
var   lxprice_array:array=new   array();
var   lxurl:array=new   array();
var   lxcontentid:array=new   array();
var   lxlist:xml=new   xml();
var   lxringtone:array=new   array();
var   lxproviderid:array=new   array();
lxlist.ignorewhite   =   true;
//lxlist.load( "http://211.139.201.237/flash/flashxml/ring/2_41.xml ");
lxlist.load( "../flash/flashxml/ring/2_41.xml ");
lxlist.onload   =function(success)
{
if(success)
{
for(var   i=0;i <lxlist.firstchild.childnodes.length;i++)
{
lxsingname_array[i]=lxlist.firstchild.childnodes[i].attributes.singname;
lxsinger_array[i]=lxlist.firstchild.childnodes[i].attributes.singer;
lxprice_array[i]   =   lxlist.firstchild.childnodes[i].attributes.price;
lxurl[i]=lxlist.firstchild.childnodes[i].attributes.url;
lxcontentid[i]=lxlist.firstchild.childnodes[i].attributes.contentid;
lxringtone[i]=lxlist.firstchild.childnodes[i].attributes.pturl;
lxproviderid[i]=lxlist.firstchild.childnodes[i].attributes.providerid;
}
}else
{
trace( "cannot   load   xml ");
}
}
发表于:2007-01-24 11:44:453楼 得分:0
不知你看得懂不,是加载xml数据.
发表于:2007-01-24 17:56:554楼 得分:0
stop();
statu   =   "请登陆 ";
var   userdata   =     new   loadvars();
var   getdata     =     new   loadvars();
loginbutton.onrelease   =   function()   {
if   (userid   ==   null)   {
statu   =   "请输入用户名!!! ";
}   else   if   (userpwd   ==   null)   {
statu   =   "请输入密码!!! ";
}   else   {
userdata.userid     =   userid;
userdata.userpwd   =   userpwd;
userdata.sendandload( "http://localhost/xiehui/test.asp ",getdata, "post ");
gotoandplay( "send ");

}
}
getdata.onload   =   function()   {
if   (getdata.userlogin   ==   "true ")   {
userid   =   getdata.userid
trace(userid)
gotoandstop( "welcome ");
}   else   {
gotoandstop( "error ");
}
};

我写的一个简单的..
我和楼主样为了这折腾半天...发现都不得其所...
网上错误的方法误人啊.....
发表于:2007-01-24 22:11:465楼 得分:0
我一般用   amfphp+flash来获取数据库的数据。
import   mx.remoting.*;
import   mx.rpc.*;
import   mx.remoting.debug.netdebug;
netdebug.initialize;

var   gatewayurl:string   =   "http://play/gateway.php ";
var   _service:service;

_service   =   new   service(   gatewayurl,   null,   "amf类名 "   );

//下面是动作
var   pc:pendingcall   =   _service.类里的函数名(参数);
pc.responder   =   new   relayresponder(   this,   "处理返回值的名称 ");

function   处理返回值的名称(   re:resultevent   )
{
      trace(   re.result   );
}
发表于:2007-01-26 08:52:356楼 得分:0
谢谢各位
我用的直接wirte的,然后设置变量就可以读出来
但怎么用flash提交数据,还是不太明白

也就是读可以,但从flash怎么能把数据写到数据库,还是不太明白
发表于:2007-01-26 09:03:547楼 得分:0
to     szjava(chen)  

没太看明白,
你这是flash里的代码呵
xml那边应该怎么写,设置什么东西??


to   maxie(maxie)  
你这个是flash登陆的
但程序端怎么来接收flash发过去的数据啊?

to   lqh777(七多)  
没看明白你这个什么意思,

==============================================
付上一段我自己写的代码
这是在程序里,注意写出的那个变量名字( "fname= "就是这个双引号里面的),要和flash里对应上
dataset   ds   =   new   dataset   ();
da.fill(ds);
if(ds.tables[0].rows.count> 0)
{
response.write( "fname= "+ds.tables[0].rows[0].itemarray[1].tostring()+ "& ");
response.write( "fnumber= "+ds.tables[0].rows[0].itemarray[2].tostring()+ "& ");
response.write( "fman= "+ds.tables[0].rows[0].itemarray[3].tostring()+ "& ");
response.write( "fphone= "+ds.tables[0].rows[0].itemarray[4].tostring()+ "& ");
response.write( "fpro= "+ds.tables[0].rows[0].itemarray[5].tostring());

}

在flash里,要把文本设置成动态文本,变量名要和上面引号里的一样
aaa是传过来的id,这样就可以动态读取每一条数据了
stop();
aaa=_root.ccc;
bbb= "http://192.168.1.11/webapplication1/webform3.aspx?fid= "+aaa
loadvariables(bbb, " ");
=====================================
第一次写这个东西,希望高手指点下
发表于:2007-01-26 20:00:078楼 得分:0
amfphp是开源的php   remoting,在amfphp内写上函数接收数据和处理,再将结果return,在flash中用上面的方法调用,就可以实现提交和获取数据。
发表于:2007-01-29 08:42:399楼 得分:0
还是不太明白
flash里怎么能把数据提交到页中??
发表于:2007-01-29 09:39:5710楼 得分:0
var   lxsingname_array:array=new   array();
var   lxsinger_array:array=new   array();
var   lxprice_array:array=new   array();
var   lxurl:array=new   array();
var   lxcontentid:array=new   array();
var   lxlist:xml=new   xml();
这里定义的数组变量,可以在flash里用一个for语句,把值显示出来就行了.

比如在flash里定义一个文李框a,报值就是a.text=   lxsingname_array[i];
发表于:2007-01-30 12:12:2111楼 得分:0
szjava(chen)   (   )  

读值现在差不多了
我现在的问题是,flash怎么把值提交出去
比如有个文本框a
怎么把a的值提交到页里去处理!
发表于:2007-01-30 12:15:2112楼 得分:0
maxie(maxie)  
stop();
statu   =   "请登陆 ";
var   userdata   =     new   loadvars();
var   getdata     =     new   loadvars();
loginbutton.onrelease   =   function()   {
if   (userid   ==   null)   {
statu   =   "请输入用户名!!! ";
}   else   if   (userpwd   ==   null)   {
statu   =   "请输入密码!!! ";
}   else   {
userdata.userid     =   userid;
userdata.userpwd   =   userpwd;
userdata.sendandload( "http://localhost/xiehui/test.asp ",getdata, "post ");
gotoandplay( "send ");

}
}
getdata.onload   =   function()   {
if   (getdata.userlogin   ==   "true ")   {
userid   =   getdata.userid
trace(userid)
gotoandstop( "welcome ");
}   else   {
gotoandstop( "error ");
}
};


你写的这些都是在flash里的吧
那在页里怎么接收这些数据呢?
发表于:2007-02-01 16:04:4713楼 得分:0
用flash   remoting吧,又方便又简单,在.net下可以直接把dataset传过去。php下也有没怎么用过
发表于:2007-10-24 14:37:3414楼 得分:0
欢迎加入as高手和as游戏开发加入49076904,


快速检索

热门点击