CHALLENGE!
Here is the code required to get data from a MySQL database result in PHP into a DataGrid on stage in Flash. Below is script.php:
<?PHP
$db = mysql_connect("yourServer", "yourUserName", "yourPassword");
mysql_select_db("yourDatabase",$db);
include_once("falconize.php"); // in same directory
echo falconize(mysql_query("SELECT * FROM yourTable",$db));
?>
In Flash with DataGrid on stage:
// in package
import com.danzen.utilities.FalconProvider;
// in constructor or some other method
var myFalcon:FalconProvider = new FalconProvider("script.php");
myFalcon.addEventListener(Event.COMPLETE, function(e:Event) {
myGrid.dataProvider = e.target.dataProvider;
});
We could be wrong, but is this the shortest number of lines around? Let us know if you find a challenger! Download the new falcon.zip for the added falconize.php file.
Dan Zen
-2010-
Filed under: Analysis, Update | Tagged: adobe, challenge, datagrid, Falcon, falconprovider, flash, MySQL, php | 8 Comments »