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

Unable to get cp.hide("Object Name"); to work

Community Beginner ,
Jun 26, 2017 Jun 26, 2017

for some reason I am unable to get cp.hide("object name"); to work.  I also cannot seem to find the cp object/properties documentation.  I have a button executing java script.  I have a simple smart shape on my slide.  The java script is simply one line.... cp.hide("smart shape name");

Does not work.

806
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
Adobe Employee ,
Jun 27, 2017 Jun 27, 2017

Hi David,

Please share a snippet of the code you are working with.

Ideally, cp.hide("myObject") and cp.show("myObject") works as expected.

Can you use something on the lines of:

if (window.cpAPIInterface.getVariableValue("someVariable")==="someValue")

{

    cp.hide("myObject1"); // hide object myObject1

    cp.show("myyObject2"); // show object myObject2

}

The JS reference documentation is currently being updated. So, the updated document shall contain all JS properties doc in a few days.

Thanks,

Saurav

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
Community Beginner ,
Jun 27, 2017 Jun 27, 2017

Thanks for the reply.  Actually, all I did was create a "test" project with one button and one smart shape.  I named the smart shape "ssTest".  The the button action JS was simply one line:  cp.hide("ssTest");.  Previewed it in a browser.  Clicked on the button but nothing happened.  I know that JS works because I commented out that code and just added window.alert("this is a test"); and it that code worked

I also tried window.parent.cp.hide("ssTest"); because I saw it as a possible option... not luck there either.

I am using the captivate 2017 trial version.  I only have two more days to evaluate it before I make a decision.

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
Contributor ,
Jun 27, 2017 Jun 27, 2017

I do not have 2017, but I created a project that toggles using .js cp.show and then cp.hide.  You can see the project here on my server

http://caleblinux.duckdns.org/cptoggler

Here is the advanced action:

That is the if, here is the else portion:

Here is my script window for else which is cp.hide as toggler = 0 by default when you start project, so it triggers the else state the first time the button is clicked.

The if window is the same thing just cp.show('triangle_1);

The only other thing I could think of, is are you executing the script in the current window?  CP allows you choose and if it is not set to current, nothing will happen

Hope that helps

Brian

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
Community Beginner ,
Jun 28, 2017 Jun 28, 2017

This is awesome response!!!  I will try it now.  Interestingly you are executing the javascript from and advanced action; whereas, I am doing it directly from a button.  Perhaps there IS a problem with the "current" window because the button does not ask about that but the advanced action does.

I am going to try it now and see what happens - only using an advanced action - set at "current".  I am down to one day for the trial.  The corporation with whom I work has licenses for captivate 8.... I hope the solution will work with that version.  If not.  Then I will have to ask them about upgrading.

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
Community Beginner ,
Jun 28, 2017 Jun 28, 2017

OK.  I tried a similar setup and it did not work.  Here is what I did.  I have a single slide project.  I added a text caption object and named it Test_Text_Caption.  I did not do anything else to the caption other than type in the caption "This is a test".

Then I created an advanced action named test_hide - I was sure to select "current"

This is the JS...

Added that advanced action to my button:

Previewed the slide in "browser", but nothing happened.

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
Community Beginner ,
Jun 28, 2017 Jun 28, 2017

I wish there was some type of debugger that could be used  to see what is happening.

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
Engaged ,
Jun 29, 2017 Jun 29, 2017

I think this works only in HTML5, so you'll have to preview selecting "HTML5 in Browser" or publish to HTML5 to make it work. Preview "In Browser" uses Flash.

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
Community Beginner ,
Jun 29, 2017 Jun 29, 2017
LATEST

Yes Gaanf!  It works in HTML5!  That IS the solution!

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
Resources
Help resources