Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to build and Interactive polling station in Flash?

Posted on 2011-03-11
4
Medium Priority
?
470 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 2000 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses
Course of the Month11 days, 23 hours left to enroll

916 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