每3秒从Flash发送数据到PHP

时间:2011-09-13 18:28:19

标签: php mysql flash actionscript send

所以,我已经学会了如何从Flash实际发送数据,但是我如何在ActionScript中每隔3秒发送一次数据呢?

1 个答案:

答案 0 :(得分:2)

使用每3秒重复一次的Timer对象:

// 3000 is 3 seconds in milliseconds, 0 means the timer
// will repeat until the end of time
var myTimer:Timer = new Timer( 3000, 0 );
myTimer.addEventListener( TimerEvent.TIMER, this._onTimer );
myTimer.start(); 

private function _onTimer( e:TimerEvent ):void
{
    // call your php function here
}

此处的课程文档:http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/Timer.html