I have an application in which there is a class that reads an XML file into an array. This array contains a number of strings that are sent when the user performs an action. Some of the strings, however, are also special instructions to the application to do something like displaying a popup. Now, I’m trying to add a wait functionality where I can place a “wait:#” step into the XML file and have the app wait # seconds. I have been trying to work with the class to add this in, but it doesn’t seem to be working.
Here’s what I have for the code:
class images.classes.StepListMgr {
...
...variables here
...
function checkFp(fp:String) {
if (fp==stepArray[0]) {
removeArrElmt(steArray, 0);
checkSpecSteps();
checkWaitStep();
}
}
function checkSpecSteps() {
//Check special step strings
if (waitInt) {
clearInterval(waitInt);
waitInt = null;
}
check4Popup();
check4EsdStartEnd();
checkDone();
}
private function checkDone() {
if (stepArray.length == 0) {
_global.modDone();
}
}
private function check4Popup() {
if (stepArray[0].length == 1) {
var step = stepArray[0][0].val;
if (step.substr(0, 6) == "popup:") {
var msgBox = step.substr(6);
var popUpParams = msgBox.split(":");
removeArrElmt(stepArray, 0);
_global.CallPopUp(popUpParams[0], popUpParams[1]);
}
}
}
private function check4EsdStartEnd() {
if (stepArray[0].length == 1) {
var step = stepArray[0][0].val;
if (step.substr(0,3)=="esd") {
if (step.substr(3)=="Start") {
_global.esdNow = true;
} else if (step.substr(3)=="End") {
_global.esdNow = false;
}
removeArrElmt(stepArray, 0);
}
}
}
function checkWaitStep() {
var step = stepArray[0][0].val;
if (step.substr(0,5)=="wait:") {
numSecs = Number(step.substr(5))*1000;
waitInt = setInterval(checkSpecSteps,numSecs);
}
}
}
It seems like the interval waitInt is clearing before I want it to. Does anyone see what I’m doing wrong here?
Chris