<< Click to Display Table of Contents >> Navigation: JavaScript > Assign a JavaScript file to an Event |
Java Scripts can be configured to be executed at certain events. You can easily drag an existing JavaScript file to an object on scene and can select the desired event. See more in the chapter Drag & Drop.
The assigned event will be displayed at the events tab of the Object (1). You can configure such an Execute Script Action by clicking on the button (2). Here you can choose an existing Script File (3) for execution or create a New Script File (4). Already existing JavaScripts can also be used in the project by using the function Import Script File (4). Files can be modified by clicking Edit selected Script File (5). After selecting the script file it is possible to configure how often the script shall be executed using the Execute on every Xth Event field.
If the script shall be executed for the OnPageRepeat or OnProjectRepeat events, the Periods (ms) property also needs to be set in the event options. This property defines how often the script will be called.
Please note that the minimal execution time for repeat actions is 10ms. We can not guarantee that we will always be exact in executing the repeat events, especially with lower repeat times and more complex scripts. The scripts should not depend on an exact execution time and thorough testing is advised!