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

Hide decimal values in Progress % on a content slide

New Here ,
Jan 09, 2014 Jan 09, 2014

Copy link to clipboard

Copied

I have successfully displayed the progress using a % value, but when I added videos that extended the duration of two slides, the percentage value went from a nice integer value to a very long decimal value.  This displays only after publishing to HTML5 and viewing on the web server (it doesn't show up when previewing in Cap7).

Preview: progress percent_preview.PNG

After Publishing: progress percent.PNG

I created a variable for the percentage set to 1, then executed an advanced action that generates the percentage.set up progress percent.PNG

How can I also limit the numeric display to an integer with no decimal values?

Thanks in advance!

Kymm

Views

1.9K

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
community guidelines
Community Expert ,
Jan 09, 2014 Jan 09, 2014

Copy link to clipboard

Copied

Captivate doesn't currently have a built-in number rounding function.  I've seen people say they had to use JavaScript to do this.

Votes

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
community guidelines
Community Expert ,
Jan 10, 2014 Jan 10, 2014

Copy link to clipboard

Copied

There are no functions in advanced actions, and that is why you have to use Javascript to truncate the result that you get in the variable v_percent.

Have a look at the website of Jim Leichliter and his excellent recent video series about JavaScript: http://captivatedev.com/2014/01/02/javascript-video-series-adobe-captivate-7/

Votes

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
community guidelines
New Here ,
Jan 10, 2014 Jan 10, 2014

Copy link to clipboard

Copied

Thanks for this resource, Lilybiri!  I'll probably get the course and start diving into JS a little.

In the meantime (to solve for this project ASAP), would you or some other kind soul be able to whip up the js script?  I'm stuck.

With my lack of js knowledge, I'm guessing that the calculations on the percent value would occur in the js script, while the Advanced action would still handle setting the variable to be calculated.  Just a guess.  Ideas?

Thanks!

Votes

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
community guidelines
Community Expert ,
Jan 10, 2014 Jan 10, 2014

Copy link to clipboard

Copied

I am still a newbie myself, working through that course that I recommend warmly. And I already know that the JS API is different for HTML5 and for SWF output. Which output do you need?

Votes

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
community guidelines
Mentor ,
Jan 10, 2014 Jan 10, 2014

Copy link to clipboard

Copied

I haven't used it, but CP Guru seems to have a widget that might help you. However, it works only in SWF outputs.

http://www.cpguru.com/rounding-widget-for-adobe-captivate/

Sreekanth

Votes

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
community guidelines
New Here ,
Jan 10, 2014 Jan 10, 2014

Copy link to clipboard

Copied

We're publishing to HTML5.

Votes

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
community guidelines
People's Champ ,
Jan 10, 2014 Jan 10, 2014

Copy link to clipboard

Copied

You might try this. Use 2 variables to display the text, one with the math and the other with the %.

$$var_1$$$$var_2$$

After you publish, open the CPM.js file and look for a line like this:

cp.cv('yourVariableName',,0,15);

Change the 15 to a 2. This is the length of the variable.

Might work in a pinch

Votes

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
community guidelines
Community Expert ,
Jan 10, 2014 Jan 10, 2014

Copy link to clipboard

Copied

You can change the number of digits also when inserting the variable. But... it will not be rounded, it will be truncated. I don't think that is the goal.

Will try tomorrow to post a script, after I have tried it out myself. Bit too late here in Belgium.

Votes

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
community guidelines
Contributor ,
Jan 20, 2014 Jan 20, 2014

Copy link to clipboard

Copied

Rounded would work for me when publishing to HTML5. I have the buttons set to activate the advanced actions, I'm just not sure how these javascripts are put into progress to "attach" to the figures which are calculated from the advanced actions/variables.

I know how to attach a JS. But not sure how the JS can latch onto the Advanced Action.

Votes

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
community guidelines
Community Expert ,
Jan 20, 2014 Jan 20, 2014

Copy link to clipboard

Copied

Why not use the command Execute Javascript in the Advanced Actions dialog box, after the calculation statements? You'll have to copy the script to the script window, it will not be in an external JS file.

Votes

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
community guidelines
Contributor ,
Jan 20, 2014 Jan 20, 2014

Copy link to clipboard

Copied

OK, I think I discovered my problem. I didn't attach the JS too ALL the slides, just the final tallied slide. Once I entered the JS (for the page) on each of the slides with data - the tallied amount was limited to the two decimals. Works like a champ.

For anyone interested, I used the JavaScript from this page:

http://josscrowcroft.github.io/accounting.js/

Votes

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
community guidelines
Contributor ,
Jan 20, 2014 Jan 20, 2014

Copy link to clipboard

Copied

I stand corrected. Still not working, with apologies.

Votes

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
community guidelines
Contributor ,
Jan 23, 2014 Jan 23, 2014

Copy link to clipboard

Copied

Lieve -

I played around with this a bit and discovered that if I changed the "Maximum Width" of the variable of "50" to "5" (which includes the decimal point), that really is all I need. Sure, it's not going to round off the figure or anything - but to be honest, it works for me.

five.jpg

Amazing how much you pick up after playing with this stuff. Normally I haven't had the need to mess around with the Advanced Actions and whatnot, but have found myself having to do that more and more. And I'm liking it. God help me. I really am.

Kevin

Votes

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
community guidelines
Community Expert ,
Jan 23, 2014 Jan 23, 2014

Copy link to clipboard

Copied

LATEST

It is truncating, if that is fine, OK.

Advanced actions are addictive. I know about that addiction.

Votes

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