|
-
the cheesy child
Addition problem
Hey guys, I managed to make a voting system by myself!
once you vote, it will go to another flash movie (results.swf) and in the results movie it will say how many votes have been made for each question.
also I have made a blue rectangle behind each vote count which i want its xscale to be the percentage of that vote compared to the others.
what I did was I made a variable called tally.
here is the script:
tally = vote1+vote2+vote3+vote4;
lets say vote 1 is 5, vote2 is 7, and vote3 and vote4 are both 0.
i made a textField to show the tally.
instead of 8 coming up, it would come up 1700.
If i can find out how to stop it from putting them infront of eachother and get them to ADD UP, that would be great!
and thats where flashkit comes in...
NOTE: hopefully this doesn't have something to do with the fact that all of the numbers are being read from seperate txt files.
Last edited by bounceboy; 04-14-2009 at 10:31 AM.
-
Bearded (M|G)od
Is vote1, vote2, etc the instance name of your TextFields?
If so, you should be using: vote1.text to get the value. And two, you need to wrap it in a parseInt() call to make sure it's an integer. When it'll pulled from a textfield, it's a String.
So it's like calling: tally = "1"+"7"+....
Your line should read: tally = parseInt(vote1.text) + parseInt(vote2.text) + parseInt(vote3.text) + parseInt(vote4.text);
-
the cheesy child
i already knew that problem, all i needed was a solution!
and the solution is parsInt() i think!
thank you!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|