Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to create an array at the root level in Captivate using javascript?

Explorer ,
Feb 24, 2016 Feb 24, 2016

I'm trying to create an array using a javascript window in captivate like this:

var questionOrder[20];

questionOrder[1]=1;

questionOrder[2]=2;

etc;

The purpose is to have a dynamic question order for a second attempt at a quiz, so that it will only include questions that the user got wrong on their previous attempt. When the user gets a question wrong, I put that question in the next available slot of the array to form a new question order for second quiz attempt. I do this using the javascript action:

questionOrder[zCount] = window.cpAPIInterface.getVariableValue("cpInfoCurrentSlide");

zCount=zCount+1;

As the action for leaving each slide, I have the following javascript executing:

iCount = iCount+1

window.cpAPIInterface.setVariableValue("cpCmndGotoSlide",questionOrder[iCount]);

This works with literal values, or even just the iCount variable, in place of questionOrder[], but it seems the array is not accessible from all slides.

How do I create an array at the root level so that it is always accessible?

TIA!

gCemb

348
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources
Help resources