Skip to main content
davidd55517822
Inspiring
June 26, 2017
Question

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

  • June 26, 2017
  • 1 reply
  • 950 views

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.

    This topic has been closed for replies.

    1 reply

    SauravGhosh
    Adobe Employee
    Adobe Employee
    June 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

    davidd55517822
    Inspiring
    June 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.

    thisguy4xapi
    Inspiring
    June 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