-
1. Re: Captivate 6 for HTML5 publish javascript question...
ElaKat Apr 30, 2013 10:29 AM (in response to cubsfan2010)I couldn't find a resource dedicated to the HTML5 API, but you might find some help in the comments section of this article: http://captivatedev.com/2012/07/01/adobe-captivate-6-the-javascript-api/
There's also this tutorial, which includes SWF and HTML5 statements: http://captivatedev.com/2012/12/17/display-the-students-name-from-your-lms-using-adobe-cap tivate-6-x/
-
2. Re: Captivate 6 for HTML5 publish javascript question...
cubsfan2010 Apr 30, 2013 11:04 AM (in response to ElaKat)Hello there- yes, I read through those posts, no luck- seems this should be
simple...this line should fetch the value of myCPVariable from Captivate
and assign it to jsVariable. But it doesn't.
var jsVariable = cp.vm.getVariableValue('myCPVariable');
I can use the cp.vm.setVariableValue command to change variables in
Captivate from the javascript window, but not get values from Captivate. Am
I missing something? Again, for HTML5...
-
3. Re: Captivate 6 for HTML5 publish javascript question...
ElaKat Apr 30, 2013 11:18 AM (in response to cubsfan2010)I'm afraid I probably can't help you, then, since I'm so new to JavaScript-- my only suggestion would be to try the other, longer syntax suggested in those comments:
var jsVariable = cp.variablesManager.getVariableValue('myCpVar');
But I don't know how that'd make a difference, especially if you got the set variable command to work... Hopefully a JavaScript guru will be able to help you.
-
4. Re: Captivate 6 for HTML5 publish javascript question...
cubsfan2010 Apr 30, 2013 12:06 PM (in response to ElaKat)Well, I seem to have narrowed it down a bit- I can retrieve system
variables and user variables I have created in CP fine, but what I can't do
is get any user input from a text entry box into javascript. I associate a
variable in the General tab of the TEB, but I can't get that variable into
javascript. To properly update a variable to hold text entered in a TEB,
what should my other settings be? What should I do on the On Focus Lost,
would that help? Thanks again for listening!
-
5. Re: Captivate 6 for HTML5 publish javascript question...
ElaKat May 1, 2013 12:12 PM (in response to cubsfan2010)Huh~ Very strange...
Unfortunately I can't test your exact scenario (no Captivate 6/HTML5), but when I tested it in 5.5 with a text entry box and an alert that calls the associated variable, it updates according to what I typed into the box. I didn't have to change any other settings or mess with On Focus Lost.
Have you tried a new project to just test that one aspect? What I did was insert a text box, associate a variable (testVariable) with it, and then on exit for that slide execute this code:
var objCP = document.Captivate;alert(objCP.cpEIGetValue('testVariable'));
(Obviously you'd need to use the approriate syntax for HTLM5 in your case.)
You could also insert a text caption with the Captivate variable and set it to show all slides of your project. That way you can make sure it's being populated when you type into the text box, and that the Captivate variable isn't getting overwritten at some point further in the project.
Sorry I don't have any concrete suggestions, but that might help narrow it down even further.
-
6. Re: Captivate 6 for HTML5 publish javascript question...
romainj Aug 8, 2013 12:32 AM (in response to ElaKat)Was anyone able to come up with a soultion to cubsfan2010's problem. I am facing the same issue with Captivate 7 and communicating with JavaScript when publishing to HTML 5. Any assistance would be appreciated.
-
7. Re: Captivate 6 for HTML5 publish javascript question...
el_enka May 28, 2014 12:39 AM (in response to romainj)Hi,
I was experiencing the same problem and it turned out that in HTML5 functions:
cp.vm.getVariableValue('someVariable');
cp.vm.setVariableValue('someVariable',newValue);
are working.
The trick was not to assign anything to variable cp. I originaly started with:
cp = document.Captivate;since this is how majority of articles about how to get flash variables were.
So if you included something similar then maybe that is the problem.
-
8. Re: Captivate 6 for HTML5 publish javascript question...
ziofonta222 Aug 19, 2014 2:53 PM (in response to el_enka)hope this can help Captivate 8 users. I have discovered, by this video
Common JavaScript Interface in Adobe Captivate 8 - YouTube
that you must use the command in this way:
window.cpAPIInterface.setVariableValue("user_defined_variable", value);
still I cannot figure why there is no documentation easy to be found about javascript usage in CP......!

