Exact DOMAIN Issue

Somewhere along the line, Flash player seems to have changed its policy on accessing data from different domains.  I used to be able to run Falcon with either http://www.danzen.com or http://danzen.com but now, it matters.  So if you are using the URL with the www to get to the page then use www in the Falcon URL.  If you are not using www then do not use www in the Falcon URL.  Or you can use relative or virtual URLs.

Falcon Challenge! Is there a simpler way to get data from a database into a DataGrid in Flash?

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-

FalconProvider Correction

An update has been made to FalconProvider in the Falcon Zip. Thanks to Kasper Kamperman saving the lonely single-result return. Please update your FalconProvider files and recompile any swf’s that use it.

%d bloggers like this: