Data Grid using Flash PHP MySQL

February 21, 2010 5:27 pm Published by Leave your thoughts

[kml_flashembed publishmethod=”static” fversion=”9.0.0″ movie=”../flash/flash-videoplayer.swf” width=”585″ height=”490″ targetclass=”flashmovie” salign=”t” wmode=”transparent” allowscriptaccess=”always” allownetworking=”all” fvars=”video_url=mp4%3Adatagrid.f4v&title=Videos%20by%20Peak%20Studios”]

Get Adobe Flash player


In this tutorial learn how to create a Dynamic Data Grid using Flash PHP MySQL.

You can watch the video (recommended) or simply grab the code from below. The Flash PHP MySQL extension is required for this tutorial.

This tutorial uses the Hello World database. Veiw the Hello World tutorial before you start this one or download and extract the MySQL script to set up your DB.

  • Import The Flash PHP MySQL publish settings for AS3.
  • Set access to “Network Only”.
  • Place the code below into a your Flash file:

    import fl.controls.DataGrid;
    import fl.controls.ScrollPolicy;
    import fl.controls.dataGridClasses.DataGridColumn;
    var DB_loc:String = "!--SET THE LOCATION OF YOUR DB FILES HERE--!";
    var i:uint;
    var totalRows:uint = 16;
    var dp:DataProvider = new DataProvider();
    var dg:DataGrid = new DataGrid();
    //----------BEGIN SELECT dataGrid------------------
    function dataGridselect(){
    var dataGrid_table = "hello_world";
    //--Array should be the table row names you wish to pull from
    var dataGrid_tableRow:Array = new Array();
    dataGrid_tableRow[0] = "id";
    dataGrid_tableRow[1] = "message";
    //where to look
    var dataGrid_where:Array = new Array();
    dataGrid_where[0] = "";
    /*values can be = <> > < <= >= BETWEEN LIKE IN You can put TABLE (i.e =TABLE)after any of the operators to use a table field in the what array value*/
    var dataGrid_like:Array = new Array();
    dataGrid_like[0] = "";
    //What to look for
    var dataGrid_what:Array = new Array();
    dataGrid_what[0] = "";

    //What to look for
    var dataGrid_functionStrings:Array = new Array();
    dataGrid_functionStrings[0] = "";

    //orderBy and ASC arrays must have the same amount of items in the array.
    //What to look for
    var dataGrid_orderBy:Array = new Array();
    dataGrid_orderBy[0] = "";

    //What to look for
    var dataGrid_ASC:Array = new Array();
    dataGrid_ASC[0] = "";
    var dataGrid_select:SelectDB = new SelectDB(dataGrid_table, dataGrid_tableRow, dataGrid_where, dataGrid_like, dataGrid_what, dataGrid_orderBy, dataGrid_ASC, dataGrid_returnFunction, dataGrid_functionStrings, DB_loc);

    function dataGrid_returnFunction(vars:URLVariables, selectRows:Array, functionStrings:Array){
    var row:Object;
    for(var i:Number = 0; i

  • Set up the PHP files that are created By the Flash PHP MysQL extension.
  • Upload your PHP files.
  • Set DB_loc to where you have uploaded your PHP
  • Publish your Flash file.
    • Categorised in:

      This post was written by admin

      Leave a Reply