1
votes

I would like assign setInterval() to pass an operator as an argument by following the Answer of LiraNuna

function actualFunction(passedValue:Number, compareFunction:Function) {
    /* ... */

    if(compareFunction(passedValue, staticValue)) {
        /* ... Do something ... */
    }

    /* ... */
}

actualFunction(6, function(x:Number, y:Number) {
     return x > y;
});

from this link pass < or > operator into function as parameter?

But I don't seem to know how to do it since only the function name is called when initiating setInterva().

Typical initiation:

function actualFunction(passedValue:Number, compareFunction:Function) {
    /* ... */

    if(compareFunction(passedValue, staticValue)) {
        /* ... Do something ... */
    }

    /* ... */
}
setInterval(actualFunction,10)

Now, I want to assign

actualFunction(6, function(x:Number, y:Number) {
     return x > y;
});

within setInterval(), how would I do it?

1

1 Answers

1
votes

Try this (not tested) :

setInterval(actualFunction, 10, 6, function(x:Number, y:Number){return x > y});

Read this for more information : http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/package.html#setInterval()

Hope this helps.