Javascript and the Ipad

Apr 29, 2013

Hi all,

I have the following working Javascript code, the only problem is that it fails when run on an Ipad:

*******************************************

var player = GetPlayer();

var currentProgress = player.GetVar("ProgressMeter");

var courseLength = player.GetVar("Pages");


player.SetVar("ProgressPercent", Math.round((currentProgress / courseLength )*100));

********************************************

"ProgressMeter" is a variable which increases by one everytime the user completes a page in the course.

I have tested this by sending an alert to the screen after each page is complete.

Running on Windows, after the first page is complete the alert correctly reads "1".

Same scenario is iOS, the alert reads "63".

Has anyone else had much experience trying to get such Javascript functions working in iOS? Am I fitting a square peg in a round hole?

Thanks,

Matt

5 Replies
Matthew Jevons

I have now figured out that there is nothing wrong with the Javascript I was using.

There is however, a problem with running triggers on the the iPad. Problems seem specific to triggers running from the Master slide.

The trigger is set to Run when the timeline starts, so should just run once.

The trigger runs multiple times on the iPad. Is there a work around for this?

Regards,

Matt

Steve Flowers

Hi, Matthew -


I wonder if there's a delay that's causing it to hit initiating slide contents multiple times. Interesting. You might want to try submitting this as a bug. Another thing that might work is attaching the trigger to another object and timing the start of the object to something like .1 or .05 seconds. If it's hanging up and looping through the start, this would prevent execution through delay.

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