Skip to main content
Skavennwyrm
Participant
November 13, 2018
Question

cpCmndGotoFrameAndResume not working consistently in javascript

  • November 13, 2018
  • 1 reply
  • 256 views

I am creating a software simulation and have a few snippets of code that are working differently upon execution. I have tested these with various alerts to see that the code follows the structure and it appears that the cpCmndGotoFrameAndResume is not functioning when I assign a value to it from a TEB.... It does work if I'm using a smart shape however and executing the code from there.

This is the code I run in my smartshape:(This code works and resets the focus on the TEB and allows the shortcut key to submit)

var frame=window.cpAPIInterface.getVariableValue("cpInfoCurrentFrame");

window.cpAPIInterface.setVariableValue("xcmndHide","Rx_@");

window.cpAPIInterface.setVariableValue("xcmndHide","Order_Info@");

window.cpAPIInterface.setVariableValue("xcmndHide","PRC_@");

window.cpAPIInterface.setVariableValue("xcmndHide","Ins_@");

window.document.getElementById('Search_3').focus();

window.cpAPIInterface.setVariableValue("cpCmndGotoFrameAndResume", frame-5);

This is the code I run in my TEB:(This code worked in SWF, but is not working in HTML5. The true statement works and the else statement is executed, but the project doesn't rewind by 5 frames as designed.)

var Correct = window.cpAPIInterface.getVariableValue("PtSearchName");

var Correct2 = window.cpAPIInterface.getVariableValue("Pt_Search_Name");

var Entered = window.cpAPIInterface.getVariableValue("TraineeEntry");

var frame = window.cpAPIInterface.getVariableValue("cpInfoCurrentFrame");

if( Entered.toLowerCase() == Correct.toLowerCase() || Entered.toLowerCase() == Correct2.toLowerCase()){

window.cpAPIInterface.setVariableValue("PtSearchName", Entered);

window.cpAPIInterface.next();

}

else{

window.cpAPIInterface.setVariableValue("cpCmndGotoFrameAndResume",frame-5);

}

If anyone knows any extra code that needs to be used to get this to execute properly, I'd greatly appreciate the help.

Thanks,

Jake

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Skavennwyrm
Participant
November 13, 2018

I have an update:

My TEB is not allowing a second attempt at entering the information so it isn't pausing to allow a second entry, it just keeps playing. I tried pausing it, but it doesn't allow the shortcut button to be used a second time. Is there a way to reset the TEB to pause as if this was the first attempt?