我创造了一个Jar, 我想填满萤火虫, 取决于有多少用户在网上使用。
我做了一点调查,找到了如何创建 XMLSocket 。 它奏效了, 但我不知道如何获得信息, 有多少人上网, 还需要CMD 窗口一直运行。
第二,我找到的是我用我的阿帕奇服务器运行的PHP、MYSQL女巫,但是我找到的教程和脚本对我没用,因为
我的问题是,在您的页面/闪光文件上找到当前在线用户数的最简单方法是什么? 是否有快速方法在闪光中完成,而不参与MISQL或PHP?
我创造了一个Jar, 我想填满萤火虫, 取决于有多少用户在网上使用。
我做了一点调查,找到了如何创建 XMLSocket 。 它奏效了, 但我不知道如何获得信息, 有多少人上网, 还需要CMD 窗口一直运行。
第二,我找到的是我用我的阿帕奇服务器运行的PHP、MYSQL女巫,但是我找到的教程和脚本对我没用,因为
我的问题是,在您的页面/闪光文件上找到当前在线用户数的最简单方法是什么? 是否有快速方法在闪光中完成,而不参与MISQL或PHP?
否, 在不使用任何外部部分( PHP、 MySQL、 Java 等...) 的情况下, 只能使用 Flash 来操作, 并不容易。 记住 Flash 是本地运行的, 因此需要与 PHP 或类似服务器进行互动, 以便与服务器进行互动, 告诉服务器用户的活动, 并向服务器询问其他用户的活动( 在线用户数量 ) 。
如果您只想在网上显示用户, 我建议您张贴的示例中显示的方式 。 只需在用户看到活动时更新数据库, 并在X分钟内未看到活动时将用户计为离线 。 没有必要为此使用 XMLSocket, 除非您希望用户以任何方式互动 。
如果您想要的不仅仅是在网上显示用户, 我建议在 ActionScript 中使用 XMLS 套件, 并查看 PHP Sockets 。
最简单的办法是将 URLRequest (我希望我得到类名正确) 发送到服务器脚本, 可以是 php 或 asspx (或任何服务器技术) 脚本/ 页面 。
服务器脚本应该返回网站的用户数量 。
例如:
var numberOfVisitors:Int = 0;
function onLoaded(e:Event):void {
numberOfVisitors = e.target.data;
// now print this numberOfVisitors where you want to on the client
}
var numVisitors:URLLoader = new URLLoader();
numVisitors.addEventListener(Event.COMPLETE, onLoaded);
numVisitors.load(new URLRequest("num_users.php"));
下一部分将是一个 php 脚本( 或任何其他服务器脚本), 记录用户数量 。 我认为您应该作为另一个 SO 问题发布?
我得到了它的工作, 但我很乐于连接 php 文件, 而不是通过它 HTTP 地址, 而是连接. swf 文件的路径( 仅是我的File.php 或路径/ MyFile.php ) 。
AS3 file:
NewRequest = new URLRequest("numOnline.php");
var numberOfVisitors:int = 10;
var NewRequest:URLRequest;
var UrlLoader:URLLoader;
UrlLoader = new URLLoader();
UrlLoader.dataFormat = URLLoaderDataFormat.TEXT;
UrlLoader.addEventListener(Event.COMPLETE, onLoaded);
UrlLoader.load(NewRequest);
function onLoaded(e:Event):void {
trace(e.target.data);
numberOfVisitors = int(e.target.data);
}
我将As3收到的文本转换为Int, 因为我还不知道如何发送 veria
"http://www.shaddeen.com/posts/read/ id- 1326397267" rel="nofollow">php文件
main PHP file (the file that as3 connects to):
<?php
include_once config.php ; //This file would contain the variables needed to connect to the database with $link, below
include_once functions.php ; //We include the functions we have created
$database = "online";
$link = mysql_connect($server, $db_user, $db_pass)or die ("Could not connect to mysql because ".mysql_error());
mysql_select_db($database)or die ("Could not select database because ".mysql_error());
usersOnline(5); //We call the usersOnline function with a time span of 5 minutes
showUsersOnline(1); //Show the number of users online, and the list of users
mysql_close($link);
?>
函数文件以 ecececho $count;
发送在线访问者的数量
Yes, you can do it without a database (MYSQL) and PHP; BUT you will still need a (Media) Server. I wouldn t suggest the following if your "only" purpose is to count the connecting clients, but if you have the reasons and have access to a Flash Media Server, you can try the following:
<强> 服务器侧: 强>
users_so
)application.onConnect
event. Add each connecting client to that SharedObject inside this handler.application.onDisconnect
event. Remove each disconnecting client from the SharedObject inside this handler.<强 > 客户端 强 > : 强 >
NetStatusEvent.NET_STATUS
event and "NetConnection.Connect.Success"
code. When connected; create a SharedObject (client-side) and get the remote from the server. SyncEvent.SYNC
event listener to the SharedObject
. This will sync with each Flash client when a user connects or disconnects from the server.See Server-Side ActionScript Language Reference for Flash Media Server 4.5, especially the Application Class. Also useful: Flash Media Server Developer Center
希望这能帮上忙
I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?
So, i have a two-dimensional Array of ID s and vote count - voteArray[i][0] = ID, voteArray[i][1] = vote count I want the top 3 voted items to be displayed in different colors, so i have a 2nd Array -...
I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...
Here [Ed. warning: full screen flash site with music]
I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...
I am looking for a step by step tutorial on securing Red5 from intrusion. This seems to be a question that comes up alot in a google search, but is never really answered in a way that makes sense to ...
Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...
For example I have a hierarchy of movie clips. mc1 is a child of mc, and mc2 is a child of mc1. Turns out that when I set mc1.visible = false; mc2.visible stays true. Is that supposed to happen?...