Using Flash, php and MySql / PDF


 Using Flash, php and MySql / PDF








Sample of the pdf document :









A typical Flash application, like a simple HTML web page, does not collect and store data on the server computer.  To store information, you need to use a file or a database and connect to the file or database using so-called server-side or middleware software.  Similarly, a typical php application accepts form data from a HTML form and produces an HTML document. This example demonstrates using Flash and php to store data in and extract data from a MySql database.  Both php and MySql are considered Open Source tools. 

The application keeps track of votes cast for 4 choices.  It is intended to represent a polling application, not a voting application.  Please note that a real voting application would need to incorporate features to allow only legitimate voters to vote and to only vote once.  A debate is going on now concerning various systems for electronic voting.  One feature considered critical by many, though not all, is that the system produce a paper trail for each vote.  This toy application does not include any of these features.  The intent is to demonstrate how Flash can connect to a php script.

Before continuing, one more warning:  A basic contract with an Internet Service Provider generally would not include support of php scripts or MySql (or any other) database.  This application and tutorial assumes php and MySql support and, moreover, assumes that a table has been created and initialized to hold the polling data. 

It is assumed that the reader has some background using Flash.  This document will explain the features of the application, not give step-by-step instructions on how to replicate it.

The initial screen for the Flash interface is the following:

If the person responds by clicking on the radio button next to Other and then Submit vote, the following screen results (at this point for this application.  I do not know where these 'votes' came from—perhaps my students).


The Flash interface consists of
  • the static text field with the words "If you had to vote today, would you vote for …."
  • 4 radio button components
  • 1 push button component
  • A dynamic text field, marked as accepting HTML tags and with a boundary

There are two layers: one layer, named board, holds all the graphics; the other layer, called actions, holds the ActionScript.  This is not necessary but is a standard way to organize an application.

The static text field is created in the usual way, using the text tool (icon A).

The radio buttons are created by clicking on the radio button icon on the component panel and dragging a button to the Stage.  The screen shot below shows the Property panel as set up for the Bush button.  In this case, the label and the data are similar.  That does not have to be the case.  Notice also the Group Name.  All four buttons would have the same group name. This works to make the Flash engine make sure that only one button is clicked.  Notice that there is no Change Handler.  This is because for this application, we wait for the 'voter' to click on the Submit Vote push button.  The Initial state and the Label Placement were left unchanged.   You need to do this for as many times as you want choices.  





Click here for  Download PDF / FREE

Using Flash, php and MySql / PDF





0 commentaires: