How to make calculations
This article teaches you how to calculate numbers with math expressions.
Here’s how you build it:
View
- Place three “Text” on the canvas, one next to the other, and write “Item 1”, “Item 2”, “Item 3”.
- Select an “Input text field” from the “Interactive input fields” section, place one next to each text “Item”.
- After the “Input text field” and before “Item 2” place a “Text” and write “+”, do the same for “Item3”.
- Next to the last input text place a text and write “=” and then a second text and write “Total”.
- Next to “Total” place an “Input text field” and go to the Properties palette; change the “Type” to “Number” and the “Value” to “0”.
- To finish, add a “Button” below (we will use it to do the calculations).
Events
With the button selected, go to the Events palette and click “Add event”.
- In the dialog box, click on “Choose Trigger”, hover over the “Mouse” section, and select “on Click”.
- In “Choose Action,” select “Set value to an element” and click on the Input text field “0”.
- Select the “Calculated” radio button for the value and click “Add expression”.
- Drag the first input text to the first value of the expression builder, then add the function “+” in the next value, drag the second input text and next add the function “+” again, and finally drag the last input text field to the remaining value. Click “Ok” and “Ok” to finish creating your event.
Simulate your prototype.