phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Flash Database: Action Script for Polling Result

Tag: flash, database, action script   Category: PHP Application
post: 27 Mar 2008 read: 279


Flash Database Step By Step Tutorial - Part 10: Now, right click on third frame. Choose action. Enter following code:

// build chart
bar._visible = true;
question.text = myVar.title;
a = 1;
var jumlah:Number = 0;
while(myVar['choice' + a] != undefined){
  jumlah = jumlah + parseInt(myVar['votes' + a]);
  a++;
}

a = 1
while(myVar['choice' + a] != undefined){
  duplicateMovieClip(answer, 'answer' + a, a);	
  duplicateMovieClip(bar, 'bar' + a, a + 300);	  
  duplicateMovieClip(persen, 'persen' + a, a + 400);
  duplicateMovieClip(lpersen, 'lpersen' + a, a + 500)
  
  var value = myVar['votes' + a];
  var label = myVar['choice' + a];
  
  this['answer' + a]._y = _root.answer._y + (this['answer' + a]._height * (a - 1));
  this['persen' + a]._y = this['answer' + a]._y;
  this['bar' + a]._y = this['answer' + a]._y;
  this['lpersen' + a]._y = this['answer' + a]._y;  
  
  this['answer' + a].text = label;
  this['persen' + a].text = Math.round((parseInt(value)/jumlah) * 100);
  this['bar' + a]._width = (parseInt(value)/jumlah) * 100;
  
  a++;
}

bar._visible = false;
stop();

Now, test it! When you click result button, You may get like this:

flash database - polling result



Series this article:
Flash Database: Text File
Flash Database: PHP for Reading Data
Flash Database: Saving Data at Server Side
Flash Database: Switching Task at Server Side
Flash Database: Starting Flash
Flash Database: Making Flash Polling Interface
Flash Database: Giving Action to Submit Polling
Flash Database: Trying Submiting Vote
Flash Database: Preparing Polling Result Interface
Flash Database: Creating Polling Result Interface
Flash Database: Action Script for Polling Result
Flash Database: Button for back to Polling

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Joomla: Fast Road to Understand Component Programming
Chart: How to Build Cool Animation Real Time Chart
Email: Send Attachement Mail
SMS : Sending SMS with PHP and ActiveXperts (Part 1)

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


624
posting