Skip to main content
Participant
November 18, 2008
Question

CS3 Risk Calculator (AS2)

  • November 18, 2008
  • 1 reply
  • 377 views
So I have been working on a calculator to help me calculate medical risks for patients. This will ultimately be a small part of a larger calculator, but I need to get this working first. I have an interface which has a drop-down for a Vessel Diameter. And there are also checkboxes to account for additional risks. What I want to do is have a "Total Risk" box dynamically reflect the changes from the drop-down and the clicking of the checkboxes.

So far, I have assigned a boolean value to the checkboxes, as well as a data value. The drop-down box has values as well (including a multiplier). But with the event listeners applied to each, the text doesn't update dynamically, and if you uncheck a checkbox, the "Total" does not reflect that change. How can I write a string to add all of these Variables together?

I finally got to a point where I could make sense and ask a somewhat intelligent question now. Still an actionscript noob, so be kind =). Any assistance would be greatly appreciated!!!!

Thank you all!
Pete~
This topic has been closed for replies.

1 reply

Ned Murphy
Legend
November 18, 2008
From what you say it sounds like you need a function that adjusts a value based on selections made... such as...

var endResult:Number = 0;

function adjustValue(withThisNumber){
endResult += withThisNumber;
trace(endResult);
}
}

so in each change handler, you would put

adjustValue(withThisNumber);

where withThisNumber is the data that you want to affect the result with (turtuosityADD, etc).
Participant
November 18, 2008
Ok, here's where the noob peeks out. I think I see where you are going with this. When I set up the Variable "endResult" and the Function "adjustValue" it looks like this:

...but when I check and uncheck the boxes, the result just continues to add rather than switch the value. What did I miss?