Highlighted

I cannot change the state of the object via Javascript by using cp.changeState

Explorer ,
Feb 14, 2020

Copy link to clipboard

Copied

Hi,

 

I have am object on the slide which has 2 states(Normal, deneme)

 

I put execute javascript to the onenter event of the slide :

cp.changeState(“myobject”,”deneme”);

 

but it is not working. I have tried different combinations:

cp.changeState(myobject,”deneme”);

cp.changeState(“myobject”,deneme);

 

Isn't there any function like changeState ? 

 

Thank you.

 

 

 

Topics

Advanced, Advanced actions

Views

302

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

I cannot change the state of the object via Javascript by using cp.changeState

Explorer ,
Feb 14, 2020

Copy link to clipboard

Copied

Hi,

 

I have am object on the slide which has 2 states(Normal, deneme)

 

I put execute javascript to the onenter event of the slide :

cp.changeState(“myobject”,”deneme”);

 

but it is not working. I have tried different combinations:

cp.changeState(myobject,”deneme”);

cp.changeState(“myobject”,deneme);

 

Isn't there any function like changeState ? 

 

Thank you.

 

 

 

Topics

Advanced, Advanced actions

Views

303

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Feb 14, 2020

Copy link to clipboard

Copied

There probably is a JS function of some kind to achieve this but...the easiest way is just to use the ON Enter event to execute an Advanced Action using the Change State Of action.  You just need to select the object and the state you want to change to.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Feb 14, 2020

Copy link to clipboard

Copied

From what I heard (JS experts) in social media, there seems not to be a function in JS. I know that a simpler way is not appreciated by those who ask explicitly for JS solutions, but advanced/shared actions have a whole bunch of State commands, and moreover there are InBuilt states which will appear automatically. Here is a link to an overview article about states:

http://blog.lilybiri.com/about-state-commands-and-a-progress-bar

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Explorer ,
Feb 14, 2020

Copy link to clipboard

Copied

Hi Lilybri,

 

You are right, I should always use built in Advanced Actions as long as it solves my problems. But here I have created progress bar for my course, and it according to variables I have display different states of my progress bar. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Lilybiri LATEST
Most Valuable Participant ,
Feb 15, 2020

Copy link to clipboard

Copied

Choice is up to you. My approach may be different,  I only use JS when CP's actions fail (random generator, arrays, formatting). For a progress bar simple or shared actions never failed me.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Engaged ,
Feb 14, 2020

Copy link to clipboard

Copied

It's cp.changeState("myobject","deneme"); actually (quotation marks on both, object and state name).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Explorer ,
Feb 14, 2020

Copy link to clipboard

Copied

Thank you very much. Yeah when I copied and pasted the codes, the marks had changed so I replaced them. Now it works. Thank you very much

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Advocate ,
Feb 14, 2020

Copy link to clipboard

Copied

Gaanf is right and I would like to add another couple little gotchas to consider...

Sometimes if you copy and paste your code - the quote marks become slanted differently like tick marks and break the code.

You might try deleting your quotes and manually put them back in.

Also verify your naming. They are case sensitive.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
Captivate User Guide
New Group