Hi all,
I am trying to update the database via a SWF file in every 10 second
I am using the URLLoader to load the file http://127.0.0.1/plus_one.php
This PHP file can do the increment in database
(http://127.0.0.1/plus_one.php works well and fine if open in a browser)
If put it into the AS3 … It works fine for the frist 10 seconds…
but after the next 20 seconds, there is no more increment to the database …
How ever … if i change the 127.0.0.1 to localhost…
It works again for the first 10 seconds, but not working after the next 20 seconds …
Is there any people can help ?
var vPath:String = "http://127.0.0.1/plus_one.php";
var ldr:URLLoader = new URLLoader();
var req:URLRequest = new URLRequest(vPath);
var t:Timer = new Timer(10000);
ldr.addEventListener(Event.OPEN, onOpen);
ldr.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHttpStatus);
ldr.addEventListener(SecurityErrorEvent.SECURITY_ERROR,onSecurityError);
ldr.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
ldr.addEventListener(Event.COMPLETE, onComplete);
t.addEventListener(TimerEvent.TIMER, addOne);
t.start();
function addOne(e:TimerEvent):void {
ldr.load(req);
}
function onOpen(e:Event):void {
trace("OK");
}
function onHttpStatus(e:HTTPStatusEvent):void {
trace("HTTP Status: " + e.status);
}
function onSecurityError(e:SecurityErrorEvent):void {
trace("Security Error: " + e.text);
}
function onIOError(e:IOErrorEvent):void {
trace("IO Error: " +e.text);
}
function onComplete(e:Event):void {
trace("Complete: ");
}