Forum Discussion
Help with Java Script to format numbers
Kim,
The problem likely has to do with a mix-up with case in your variable names. For example, you have this line of code in your message above:
player.SetVar("txtDepAmt",txtvalue);
...but in the .story file you attached at the beginning of this thread, you don't have a Storyline variable named "txtDepAmt." Instead, it is named "TxtDeptAmt," which to Storyline is something completely different. Spelling and case of variable names are critical in JavaScript-Storyline communication.
My recommendation is to copy your JavaScript code to Word or Notepad and display it alongside Storyline's Variables dialog box to make absolutely certain that any custom Storyline variables you are getting into JavaScript or setting from JavaScript are spelled exactly the same (including case) in JavaScript as they are in the Storyline Variables panel.
- SteveGannon4 years agoCommunity Member
I also just noticed your code has a line that includes:
playerGetVar
...but it should be:
player.GetVar
See the very basic sample attached (I put the two blocks of code in separate Execute JavaScript triggers for clarity but in practice I would generally put these together in one trigger).
Related Content
- 10 months ago
- 7 months ago
- 4 months ago
- 2 months ago