Skip to main content
Inspiring
July 15, 2015
Answered

How can we Show-Hide or Enable-Disable Captivate Objects using javascript??

  • July 15, 2015
  • 1 reply
  • 5034 views

How can we Show-Hide or Enable-Disable or change the color of the Captivate Objects using javascript ??

Any ideas, actually I want to avoid Advance Action type dropdown assisted programming and want to do text coding the actions.

This topic has been closed for replies.
Correct answer TLCMediaDesign

I have certain conditional actions emplaced in JS on the bases of the

values stored in SCORM VARIABLES, so it is just reiterating the logics in

the advance actions to hide and display the objects. If I do it by

transporting values from external interface. In addition to that similar

operations are to be applied on several objects, if these are named

properly like obj1, obj2, obj3 etc. They can be recalled in a loop in JS

like 'obj'+i


You can show/hide and enable using the following syntax.

cp.show("obj"+i)

cp.hide("obj"+i)

cp.enable("obj"+i)

cp.disable("obj"+i)

1 reply

RajeevAdobe
Adobe Employee
Adobe Employee
July 15, 2015

Hello,

This might help you in understanding the logic of show or hide objects.

Regards,

Rajeev.

Lilybiri
Legend
July 15, 2015

Hmmm, Rajeev. I looked at your document but cannot see how this can help the OP? He was not asking about show/hide using an advanced/shared action (have plenty of them on my blog) because he doesn't want to use advanced actions, with its point-and-click approach. He wants JavaScript to show/hide and enable/disable.

I can only point to the Help about JS: Common JS interface

This supposes you are using Captivate 8, because there was no common interface for SWF and HTML5 output in CP7.

And about show/hide vs enable/disable: be careful with shape buttons especially when they are timed for the rest of the project. Normally Hide will also disable an interactive object, and Show will enable it, but that is not the case for those shape buttons: you have both to Disable and Hide, or Show and Enable in several circumstances.

Just out of curiosity: why do you want to avoid advanced/shared actions? They are converted to JS on runtime. I can totally understand the use of JS for more complicated functions (where you embed the functions in the default JS file that you'll use in all projects) but why for these simple actions like Show/Hide and Enable/Disable. Especially now with shared actions?

zaidinhAuthor
Inspiring
July 15, 2015

I have certain conditional actions emplaced in JS on the bases of the

values stored in SCORM VARIABLES, so it is just reiterating the logics in

the advance actions to hide and display the objects. If I do it by

transporting values from external interface. In addition to that similar

operations are to be applied on several objects, if these are named

properly like obj1, obj2, obj3 etc. They can be recalled in a loop in JS

like 'obj'+i