Show a Mathematical Sum based on user input?

I’m trying to create an interactive electoral college map and I would like to be able to show a pair of point results based upon whether the user has set a state to red or blue.

Basically if Illinois is set to red then 20 points are added to the red sum and if it is set to blue 20 points are added to the blue sum. Is there some simple documentation on this or is this getting a bit too complicated for a beginner on his second week?

Edit: My plan is to simply have the user click the state to allow a blue overlaid version to become visible or invisible revealing the red version underneath via an opacity change and a timeline for each state.

So one thing that Hype might be able to help you with here is if you set the value of the state to represent a HTML attribute. So if you have the state, select it, and modify its attribute to be:

34%20PM

Then you can get this value in JavaScript. This adds votes="20" to that element.

You would need to get into JavaScript to add up the values of all the red and blue states.
You can set ‘red’ or ‘blue’ with classes. So the pseudo code would look like:

get ‘blues’, and their ‘votes’ values their HTML attributes
get elements with class ‘red’ and their ‘votes’ values from the HTML attributes
show blues
show red

There’s a million ways to do this, but Hype doesn’t support this type of arbitrary addition + logic – the hard part is deciding how to structure that. Building a map is pretty simple in Hype though…

OK. I’ve only got a week and I’ve never done more than drop html code referencing Javascript into my documents. Thanks for the advice.

I think I’ll just stick with making a map than changes the color of the states and the result numbers to match which election year you click. At least I had no problem figuring out how to batch process 100 Adobe Illustrator files (50 states in red AND blue) into 100 PNG files.