0

Hei guys, i added these lines of code as javascript on succes of a click box in captivate :

document.onkeydown = function (e) {
    if (e.keyCode == 16) {
       document.Captivate.cpEISetValue('m_VarHandle.cpCmndGotoSlide', 5);
    }
};

It does good what it does but after first atempt even if im on another slide and i press shift key it goes to slide 5 :( Another question is, how to set an mousedown and onkeyup event on same button. What i try to achieve is to jump to next slide if i press shift key and i click on a click box.

EDIT: new code:

document.onmousedown = function (e) {
var currentSlide = document.Captivate.cpEIGetValue('m_VarHandle.cpInfoCurrentSlide');
      if(currentSlide == 5 && e.keyCode == 16){
          document.Captivate.cpEISetValue('m_VarHandle.cpCmndGotoSlide' , 5);
}
};

As i think it, should fire the function when i click on it, BUUUT , unfortunately it doesnt work... seems like Captivate doesnt recognize onmousedown event :|

RE-EDIT : i figurate out how to make it work. Here's the code :

document.onkeydown = function(e) {
var currentFrame = document.Captivate.cpEIGetValue('m_VarHandle.rdinfoCurrentFrame');
var currentSlide = document.Captivate.cpEIGetValue('m_VarHandle.cpInfoCurrentSlide');

      if(currentSlide == 5 && e.keyCode == 16){
          document.Captivate.cpEISetValue('m_VarHandle.rdcmndGotoFrameAndResume' , 491);

}
};

document.onkeyup = function(e) {
var currentSlide = document.Captivate.cpEIGetValue('m_VarHandle.cpInfoCurrentSlide');

      if(currentSlide == 5){
          document.Captivate.cpEISetValue('m_VarHandle.rdcmndGotoFrameAndResume' , 485);

}
};

Now everything's just PERFECT! its exactly what i wanted to do... but it works only on localhost... only when i press F12 in Captivate :( if i try to run exported swf or html from captivate it crush :((( Any ideea ?

Proless
  • 217
  • 4
  • 13

3 Answers3

0
var slide = 4;
document.onkeydown = function (e) {
    if (e.keyCode == 16) {
       slide++;
       document.Captivate.cpEISetValue('m_VarHandle.cpCmndGotoSlide', slide);
    }
};

Bassically you want to increment the position (second argument of cpEISetValue), in your code, you always set it to 5. Also make sure to reset it when it reaches the max slider position.

Romeo
  • 521
  • 5
  • 20
0

You can check the SHIFT key inside the click:

var slide = 4;
$('body').click( function (e) {
    if (e.shiftKey) {
       slide++;
       document.Captivate.cpEISetValue('m_VarHandle.cpCmndGotoSlide', slide);
    }
});

check here

Community
  • 1
  • 1
alquist42
  • 739
  • 1
  • 8
  • 21
0

If you want to set a click with a shift key you can use this:

$(document).click(
  function(e){
    if(e.shiftKey){
      document.Captivate.cpEISetValue('m_VarHandle.cpCmndGotoSlide', 5);
    }
  }
);

the same works with ctrlKey, and altKey

And to change the page fine you need a control variable like this:

var current_page = 1;

$(document).click(
  function(e){
    if(e.shiftKey){
      current_page++
      document.Captivate.cpEISetValue('m_VarHandle.cpCmndGotoSlide', current_page);
    }
  }
);

I think this is the final code that you need (you maybe need to change document to an id or class that you are using like "#element_id" or ".element_class")

rneves
  • 2,013
  • 26
  • 35