将运算符传递给 setInterval() 动作脚本
Passing operator to setInterval() actionscript
我想按照 LiraNuna
的回答分配 setInterval()
以将运算符作为参数传递
function actualFunction(passedValue:Number, compareFunction:Function) {
/* ... */
if(compareFunction(passedValue, staticValue)) {
/* ... Do something ... */
}
/* ... */
}
actualFunction(6, function(x:Number, y:Number) {
return x > y;
});
来自这个linkpass < or > operator into function as parameter?
但是我好像不知道怎么弄,因为启动的时候只调用了函数名setInterva()
。
典型启动:
function actualFunction(passedValue:Number, compareFunction:Function) {
/* ... */
if(compareFunction(passedValue, staticValue)) {
/* ... Do something ... */
}
/* ... */
}
setInterval(actualFunction,10)
现在,我要分配
actualFunction(6, function(x:Number, y:Number) {
return x > y;
});
在 setInterval()
内,我该怎么做?
试试这个(未测试):
setInterval(actualFunction, 10, 6, function(x:Number, y:Number){return x > y});
阅读此内容了解更多信息:http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/package.html#setInterval()
希望对您有所帮助。
我想按照 LiraNuna
的回答分配setInterval()
以将运算符作为参数传递
function actualFunction(passedValue:Number, compareFunction:Function) {
/* ... */
if(compareFunction(passedValue, staticValue)) {
/* ... Do something ... */
}
/* ... */
}
actualFunction(6, function(x:Number, y:Number) {
return x > y;
});
来自这个linkpass < or > operator into function as parameter?
但是我好像不知道怎么弄,因为启动的时候只调用了函数名setInterva()
。
典型启动:
function actualFunction(passedValue:Number, compareFunction:Function) {
/* ... */
if(compareFunction(passedValue, staticValue)) {
/* ... Do something ... */
}
/* ... */
}
setInterval(actualFunction,10)
现在,我要分配
actualFunction(6, function(x:Number, y:Number) {
return x > y;
});
在 setInterval()
内,我该怎么做?
试试这个(未测试):
setInterval(actualFunction, 10, 6, function(x:Number, y:Number){return x > y});
阅读此内容了解更多信息:http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/package.html#setInterval()
希望对您有所帮助。