Quantcast
Channel: Adobe Community : All Content - Adobe Captivate
Viewing all articles
Browse latest Browse all 30250

Javascript not working

$
0
0

Hi All

 

I have the following code with 2 issues, that I would love some help with. I have based this on the post http://forums.adobe.com/message/5251208 but had to alter it to get it working for me. I am using Captivate 7

 

The first issue is that when i attemp to call the line of code

  objCP.cpEISetValue('cpCmndGotoSlide', 22);

 

It does nothing. I have tried a variety of different slide numbers, but to no avail. If i try and debug in IE it indicates an a generic error. Yes there is a slide 22

 

Its wierd that in the other part of the else statement, it works no problems with a variable. I have also tried swapping the order around as well, still no luck.

 

The other problem i have is in my array, i end up with an empty element. This then takes me back to the first slide when its encountered, which is not waht i wanted. Any ideas on this one ?

 

 

 

var objCP = document.Captivate;

var randomNumbers = [];

var slideViews = 0;

var resume = 0;

 

 

function Shuffle(){

for(i=2; i<22; i++) {

randomNumbers[i-1] = i;

}

var n = randomNumbers.length;

var tempArr = [];

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

    tempArr.push(randomNumbers.splice(Math.floor(Math.random()*randomNumb ers.length),1)[0]);

  }

  tempArr.push(randomNumbers[0]);

  randomNumbers=tempArr;

}

if (objCP.cpEIGetValue('m_VarHandle.SlideList') == 'Start') {

    Shuffle();

    objCP.cpEISetValue('m_VarHandle.SlideList',randomNumbers);

    resume++;

    JumpSlide();

  }

else{

randomNumbers = objCP.cpEIGetValue('m_VarHandle.SlideList').split(',');

    JumpSlide();

}

function JumpSlide() {

slideViews=objCP.cpEIGetValue('m_VarHandle.scenarioNumber')

  if (slideViews > 2) {

    objCP.cpEISetValue('cpCmndGotoSlide', 22);

  }

  else{

    objCP.cpEISetValue('cpCmndGotoSlide', randomNumbers[slideViews]-1);

    slideViews++;

    objCP.cpEISetValue('m_VarHandle.scenarioNumber', slideViews);

  }

};

 

 

 

Thanks

 

Luke


Viewing all articles
Browse latest Browse all 30250

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>