Skip to main content
Participant
December 2, 2015
Question

Captivate 9- How to calculate a total

  • December 2, 2015
  • 1 reply
  • 619 views

Hello,

I am looking for a way to calculate a number total using Hot Spots. I am currently working on creating multiple hot stops on an image. I'd like to tie numbers to individual hot spots . When the hot spot is clicked, you are shown a number. When you click another hot spot, a new number is added to your total and so on. Is it possible to create something like this? Or maybe I am using the wrong tool.

Thank you!

This topic has been closed for replies.

1 reply

Lilybiri
Legend
December 2, 2015

How has that total to be shown? Do you use states to show the number or the old Show command? Do the hotspots remain active after they have been clicked the first time? If yes, what has to happen when a hotspot is clicked another time? Are the numbers stored in variables or just literals?

You'll need to create a shared action for sure, that will 'do' the showing, either by changing a state or by showing a text container + do the calculation. How that calculation has to be done, depends on the answers on my questions.

Participant
December 2, 2015

Thank you so much for all your responses and help. Currently, I am using states to show the numbers. I created multiple states for the green box and linked them to invisible hot spots throughout the map. Once the hot spots are clicked, it should reveal a number In this case, you click on a country and it shows you a number. Click on another country and that new number is added to the one you original clicked. I'm not sure how to store the numbers in variables. Is that where I should be doing my calculation?

Lilybiri
Legend
December 2, 2015

Is the sum showing up in the top right corner? Or is that the location where the 'number' is showing for each country? It will be easier if you have that total in a separate location from the individual numbers. In that scenario:

  1. create a user variable v_total with a default value of 0
  2. insert that variable in a text container (top right?)
  3. create an action to be used for the Success action of the hotspots, I will use the name 'number' for the state where the number shows up, and 'country' for the hotspot:
        Change state of 'country' to 'number'
        Expression v_total = v_total + x               (where x is that number, I suppose it is a literal, not a value stored in another variable)


If this is indeed acceptable to you, I would suggest creating a shared action. You will have 3 parameters to be assigned for each application of the shared action:

  1. The hotspot ("country" in my example)
  2. The state ("number")
  3. x   (the literal that will be different for each country)