Solved

How to build and Interactive polling station in Flash?

Posted on 2011-03-11
4
435 Views
Last Modified: 2012-05-11
Hi,

I am trying to develop a simple polling station for an event. The polling station will be driven by a P.C with a touchscreen controller and the output will display a simple bar chart that will update in real-time. I believe this should be quite easy in flash, but I could just do with some pointers.

I have created an rough interface like the attached. There will be 5 buttons for voters to choose. Each voter can only select one button. When they make their selection I need three things to happen :

1) I need the values to be shown as a percentage of the total number of votes. (i.e: if only 2 people vote each would display 50%. If 4 voted it would calculate the total of each to be 25%)
2) I need the values to create a simple bar chart of the figures.
3) Add their vote to the total number of votes.

Any pointers would really help as I am primarily a designer with very basic flash or programming knowledge.

Many thanks,


 Interface mock up
0
Comment
Question by:ajstokes
  • 2
  • 2
4 Comments
 
LVL 19

Expert Comment

by:quizengine
ID: 35116362
see the example app I've uploaded. Check layer 1 frame 1 for the initialisation of the variables and the function that updates the graph. (select the frame and see the actions panel - F9 if the actions panel isn't showing)

Click one of the voting buttons and again see the actions panel to see the code.
voting-app-cs3.fla
0
 

Author Comment

by:ajstokes
ID: 35118894
Hi quizengine,

Thank you so much for your reply and the sample code (with comments!) This is a great starting point for me to try and figure this out.

The code works as expected although by the time I get to say 60+ votes the graph is really small. I understand this is because each part together makes up the full 300px height but I wonder, is there a way to scale the vertical axis of the chart so that it would utilize the full space?

The other thing I need to figure out is a) How to display the total number of votes (i.e : the total number of clicks from all buttons) and more importantly b) how to display the figure above each column as a % of the total number of votes taken.

I will keep searching, but if you had any other tips would be great.

Many thanks again!
0
 
LVL 19

Accepted Solution

by:
quizengine earned 500 total points
ID: 35121190
New version attached
voting-app-v2-cs3.fla
0
 

Author Comment

by:ajstokes
ID: 35124731
quizengine you are amazing and I am very grateful for your help! The code works great!

If anyone else is reading this would they care to comment? quizengine, you have helped more than enough, I am just experimenting with the code to add more features :

1) A way to alter the opacity of the columns, so the leading column is 100% opacity through to the lowest being 25% opacity. This would help the results stand out.

2) I have just discovered that there will be approx 200 people at this event. How easy is it to modify the code so that each vote click advances the column +1 increment (total height of each column would be ~200) rather than scaling each block to a % all clicks on each click? I'd still like to display the % of total, but I think visually it may work better than having every block scale after every click.

3) Is it possible to attach the number of votes for each column near the top of each column. This would mean the text would move as each column was voted.

quizengine, many many thanks again for your solutions. If anyone else would care to comment, it would be most appreciated! Thank you experts!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now