JS Difference between Flash and HTML5

Jan 06, 2016

Hi,

I spent some time tracking down a weird issue but it came down to this:

var sumit=0;

for (i=1;i<=5i++)
{

sumit+=p.GetVar("m"+i);

}

This code adds the Storyline variables (m1,m2,m3,m4,m5) together and stores it in the sumit JS variable.

The result in Flash is correct. It's the sum of the values.

In HTML5, the result is the "text" like 734859 (if the variables were m1=7, m2=3, m3=4, etc.) So instead of adding number together, it sticks the digits together like text. I had to modify the code to:

sumit+=parseInt(p.GetVar("m"+i));

To make sure it treats the value as a number. 

But why is it the value received as a number in Flash (correctly) but as a text in HTML5? (All Storyline variables are declared as numbers.)

1 Reply
Ashley Terwilliger-Pollard

Hi Zsolt,

I'm certainly not equipped to identify Javascript elements or why they may not work correctly in Flash, so you may want to reach out to folks here in the community who have responded to other Javascript threads. They may be able to help check the code and how it's being run.

You will want to ensure you're viewing the output in an HTML5 supported browser as detailed here as well. 

This discussion is closed. You can start a new discussion or contact Articulate Support.