_global.functionOK = true;
btn.onRelease = function() {
_global.functionOK = false;
};
//start interval
var intervalID:Number = setInterval(myLoop, 10000);
function myLoop() {
//check the _global variable and then proceed if true
if (_global.functionOK) {
//do this stuff
} else {
clearInterval(intervalID);
}
}