Need a fresh pair of eyes on some JavaScript code
The JavaScript code in the attached story file works perfectly when the project runs in Flash but not in html5. When you tab to the next field in the html version the totals increment by some crazy values.
I have attached a flash version and an html5 version so that you can see the difference.
html5 output: https://360.articulate.com/review/content/4f158dc1-2476-4243-ad10-d6fc471db6f6/review
Falsh output: https://360.articulate.com/review/content/25ab0d95-fdc4-4511-85aa-e87540278bb0/review
I have been looking at the code for so long now that I think I need some fresh eyes on it. I have attached the story 2 file if anyone wants to take a look and help me out.
7 Replies
Good work Nancy, I think you broke JavaScript.
That's really weird behaviour.
I've just spent the last half an hour trying to figure this out and haven't gotten anywhere.
I'll take another look later when I have a spare minute.
Hello Nancy
just declare var newP as number at all instances.
var newP = Number(player.GetVar("miscPercent"));
good work!
Is that all it needs Pankaj? Good work figuring that out.
yes, let me know the result.
Thank you so much Pankaj, it now works perfectly.
Thanks for taking the time to look at the code. I really appreciate it.
No worries Nancy, glad it was an easy fix.