I have a javascript code to Execute javascript in Specific Frame of the Timeline in Adobe Captivate.
This is the code in JS Window :
window.cpAPIEventEmitter.addEventListener("CPAPI_VARIABLEVALUECHANGED",function(){
if(window.cpInfoCurrentFrame === window.exactFrame)
{
cp.movie.pause(cp.ReasonForPause.CPCMNDPAUSE);
speechResult ="hello";
window.cpAPIInterface.setVariableValue("SpeechReceived",speechResult);
}
},"cpInfoCurrentFrame");
It will fire JavaScript code on a specific frame (whatever frame number that "exactFrame" returns) in the timeline... To be more clear I used these lines of code to pause the timeline at specific frame, then inject my string variable ("hello" for example) from javascript to captivate (That I was successful because I can see changing variable "SpeechReceived" on my screen). But the problem is even though I see "SpeechReceived" is changed to "hello" on my screen, Captivate "While loop" doesn't work and I can't "Continue" the movie ...
Here is Screen Shot of my simple project :
And these are my decisions blocks that construct "reza" script :
First three actions calculate the exact frame of second 2 of the slide, and save that frame number to "exactFrame" variable.
Then it executes the Script_Window right at second 2 of the timeline.
in Script_Window I have a JavaScript to change the value of my variable named "SpeechReceived" and also it pauses the timeline as I said before.
Now please look at my last decision :
I want to continue my paused timeline whenever "SpeechReceived" is equal to "hello" but here is the problem : although my variable "SpeechReceived" changes to "hello" nothing happens ... it seems that while loop doesn't work and something goes wrong here...Am I missing Something ??? (It's a voice recognition app that changes "SpeechReceived" to "hello" on user voice input ...
User says "hello" and the timeline continues the movie ... actually we wait for the user's voice ("hello") in order to continue...
It sounds mysterious why in the world that while loop doesn't work ...)
Any Idea how to fix that bug ???