如何在动作脚本中添加 setInterval()?
How can I add setInterval() in actionscript?
我正在通过 Action Script 从服务器接收图像。我想以连续的方式接收图像。
我是这个动作脚本的新手,写了下面的代码
我正在用 Flash 编写如何向其中添加 `setInterval()。
var my_pb:mx.controls.ProgressBar;
my_pb.mode = "manual";
this.createEmptyMovieClip("img_mc", 999);
var my_mcl:MovieClipLoader = new MovieClipLoader();
var mclListenerbject = new Object();
mclListener.onLoadStart = function(target_mc:MovieClip) {
my_pb.label = "loading: "+target_mc._name;
};
mclListener.onLoadProgress =function(target_mc:MovieClip,
numBytesLoaded:Number, numBytesTotal:Number) {
var pctLoaded:Number = Math.ceil(100*(numBytesLoaded/numBytesTotal));
my_pb.setProgress(numBytesLoaded, numBytesTotal);
};
my_mcl.addListener(mclListener);
my_mcl.loadClip("123.php?device=9113......", img_mc);
谢谢你
这里有一个关于如何在 ActionScript 3 中使用 setInterval 的例子
var myInterval:uint = setInterval (testInterval, 1000);
function testInterval():void
{
trace('test interval');
// to stop the interval
clearInterval(myInterval);
}
关于 ActionScript 2,我相信以下代码也能正常工作,但您也可以在 official documentation.
中阅读更多相关信息
var myInterval = setInterval(testInterval, 1000);
function testInterval()
{
// include your logic scope here
// to clear the interval
clearInterval(myInterval);
}
我正在通过 Action Script 从服务器接收图像。我想以连续的方式接收图像。
我是这个动作脚本的新手,写了下面的代码
我正在用 Flash 编写如何向其中添加 `setInterval()。
var my_pb:mx.controls.ProgressBar;
my_pb.mode = "manual";
this.createEmptyMovieClip("img_mc", 999);
var my_mcl:MovieClipLoader = new MovieClipLoader();
var mclListenerbject = new Object();
mclListener.onLoadStart = function(target_mc:MovieClip) {
my_pb.label = "loading: "+target_mc._name;
};
mclListener.onLoadProgress =function(target_mc:MovieClip,
numBytesLoaded:Number, numBytesTotal:Number) {
var pctLoaded:Number = Math.ceil(100*(numBytesLoaded/numBytesTotal));
my_pb.setProgress(numBytesLoaded, numBytesTotal);
};
my_mcl.addListener(mclListener);
my_mcl.loadClip("123.php?device=9113......", img_mc);
谢谢你
这里有一个关于如何在 ActionScript 3 中使用 setInterval 的例子
var myInterval:uint = setInterval (testInterval, 1000);
function testInterval():void
{
trace('test interval');
// to stop the interval
clearInterval(myInterval);
}
关于 ActionScript 2,我相信以下代码也能正常工作,但您也可以在 official documentation.
中阅读更多相关信息 var myInterval = setInterval(testInterval, 1000);
function testInterval()
{
// include your logic scope here
// to clear the interval
clearInterval(myInterval);
}