Why While loop deosn't work?
After a lot of efforts, I found a code thanks to TLCMediaDesignhere : Re: How to Execute javascript in Specific Frame of the Timeline?
This is the code in JS Window :
window.cpAPIEventEmitter.addEventListener("CPAPI_VARIABLEVALUECHANGED",function(){
if(window.cpInfoCurrentFrame === 90)
{
JavaScript Goes Here
}
},"cpInfoCurrentFrame");
It will fire JavaScript code on a specific frame (for example frame 90) in the timeline...
Then I build my project based on that JS code to fire my own JS code on second 2 of the timeline.
Here is Screen Shot of my simple project :


And these are my decisions 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 thanks to TLCMediaDesigncode 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
using this code :
window.cpAPIEventEmitter.addEventListener("CPAPI_VARIABLEVALUECHANGED",function(){
if(window.cpInfoCurrentFrame === window.exactFrame)
{
cp.movie.pause(cp.ReasonForPause.CPCMNDPAUSE);
SpeechReceived = "hello";
}
},"cpInfoCurrentFrame");
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 ???
Any Idea how to fix that bug ???
