此篇文章为
[url=http://www.roading.net/blog][1u]
[color="#800080"]roading[/color]
[/1u][/url]
所有,欢迎转载,但请注明原处.
看见还有很多人在研究
[url=http://www.85flash.com/Get/Flashzhuanlan/]flash[/url]
的socket,其中经常会出现一些问题,所以将我以前写的一个程序代码拿出来给大家参考...
服务器端程序请参考:
[url=http://www.roading.net/blog/article.asp?id=78][1u]
[color="#800080"]http://www.roading.net/blog/article.asp?id=78 C#源代码[/color]
[/1u][/url]
这是flash的代码,代码比较简单,没有写什么注释.
//----------------------------------------------------------------------------------------------------------------
/*
[url=http://www.roading.net/blog][1u]
[color="#800080"]http://www.roading.net/blog[/color]
[/1u][/url]
代码由roading编写...欢迎测试...
*/
function OnConnect(success) {
if (success) {
trace("Connection succeeded!");
isConn = true;
socket.send("CONN|"+userNameIt.text);
userList.addItem(’所有人’);
} else {
trace("Connection failed!");
}
}
function OnData(src) {
// 此处是您的语句
trace(src)
strArray = src.split(’|’);
temp = strArray[0];
trace(strArray.length+’\t’+strArray);
if (temp == ’LIST’) {
userList.removeAll();
for (i=1; i
本文转自:http://www.5uflash.com/flashjiaocheng/Flashyuweb/815.html
[url=http://www.roading.net/blog][1u]
[color="#800080"]roading[/color]
[/1u][/url]
所有,欢迎转载,但请注明原处.
看见还有很多人在研究
[url=http://www.85flash.com/Get/Flashzhuanlan/]flash[/url]
的socket,其中经常会出现一些问题,所以将我以前写的一个程序代码拿出来给大家参考...
服务器端程序请参考:
[url=http://www.roading.net/blog/article.asp?id=78][1u]
[color="#800080"]http://www.roading.net/blog/article.asp?id=78 C#源代码[/color]
[/1u][/url]
这是flash的代码,代码比较简单,没有写什么注释.
//----------------------------------------------------------------------------------------------------------------
/*
[url=http://www.roading.net/blog][1u]
[color="#800080"]http://www.roading.net/blog[/color]
[/1u][/url]
代码由roading编写...欢迎测试...
*/
function OnConnect(success) {
if (success) {
trace("Connection succeeded!");
isConn = true;
socket.send("CONN|"+userNameIt.text);
userList.addItem(’所有人’);
} else {
trace("Connection failed!");
}
}
function OnData(src) {
// 此处是您的语句
trace(src)
strArray = src.split(’|’);
temp = strArray[0];
trace(strArray.length+’\t’+strArray);
if (temp == ’LIST’) {
userList.removeAll();
for (i=1; i
本文转自:http://www.5uflash.com/flashjiaocheng/Flashyuweb/815.html