Highlighted

Can I show and Hide objects based on current frame number

New Here ,
Jan 24, 2020

Copy link to clipboard

Copied

Hi is it possible to show or hide objects in captivating based on the current frame number through advanced actions? For example, I want to create an advance action that shows an object on stage when the play head reaches frame number 490,

TOPICS
Advanced actions

Views

177

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

Can I show and Hide objects based on current frame number

New Here ,
Jan 24, 2020

Copy link to clipboard

Copied

Hi is it possible to show or hide objects in captivating based on the current frame number through advanced actions? For example, I want to create an advance action that shows an object on stage when the play head reaches frame number 490,

TOPICS
Advanced actions

Views

178

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
Jan 24, 2020 0
Adobe Community Professional ,
Jan 24, 2020

Copy link to clipboard

Copied

Perhaps explaining why you would want to do it this way might help use suggest a solution to your problem. Personally, if I wanted an object to appear on the stage at a very precise time I would simply place it on the timeline at that precise time. Far easier to do than writing advanced action (I could think about it for a while but I'm not certain how to have a frame number trigger an action in advanced actions).

Paul Wilson, CTDP | https://captivateteacher.com

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...
Jan 24, 2020 0
Most Valuable Participant ,
Jan 25, 2020

Copy link to clipboard

Copied

There may be a good reason to want this approach, but you didn't explain it.

Some ideas; use the Delay Command in an advanced action tirggered by the On Enter event of the slide. 

Or use JavaScritp where it is possible to create events for each frame.

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...
Jan 25, 2020 0
Advocate ,
Jan 27, 2020

Copy link to clipboard

Copied

I will agree with the others that a little more context could help provide a more elegant solution.

Seems there is always many ways to accomplish the same goal.

The first one that popped into my head from a JavaScript standpoint would be to have an interval run onEnter to check the current frame and if it is equal to 490 show the object. In the example below I have a box on the stage named box that is hidden by default and extended on the timeline to accommodate 490 frames.

 

var showBox = setInterval(box490, 10);

function box490() {
if (cpInfoCurrentFrame==490) {
cp.show("box");
clearInterval(showBox);
}
}

 

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...
Jan 27, 2020 0
Adobe Community Professional ,
Jan 27, 2020

Copy link to clipboard

Copied

You can execute this JavaScript in an Advanced Action or onEnter of the slide:

 

window.cpAPIEventEmitter.addEventListener("CPAPI_VARIABLEVALUECHANGED",function(){

if ( window.cpInfoCurrentFrame === 490 )
{
cp.show("Element Name");
cp.hide("Element Name");
}

},"cpInfoCurrentFrame");

 

Just change the "Element Name" to the names of the elements you want to show or hide.

 

Note that the cpInfoCurrentFrame is a running count throughout the project. You can add code to have it reset a count on each slide so you don't have to figure out the actual frame count, on slide 20 for example.

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...
Jan 27, 2020 0