Flash Builder/Flex 4 and ZendAMF alternative connection example

I was attempting to try out a simple test of ZendAMF and Flash Builder. I had begun by building the test using WAMP on my local machine. I began by using the built in Connect to Data/Service Wizard built into Flash Builder.  The example I was following was from an article over at the Zend Developer Zone called: Data-centric Adobe Flash Builder development with the Zend Framework. Everything worked slick as can be running locally on WAMP but when I tried using the same data connection with my site on my hosting company, I was ending up with errors due to the age of mySQL and PHP that my host is currently using. I am still working on resolving those problems. But in the meantime I was needing to get it to work.  I decided to incorporate the simple example Lee Brimelow used with his Flash and Zend AMF tutorial.

The example here is a simple voting screen to pick from a set of actors for best actor and worst actor. It holds a simple SharedObject variable to determine if you have already voted and keeps you from voting twice.

 

Here is the awards.php file:

class awards {
public function __construct()
{
require("/*path to file outside of public web directory*/configConn.inc.php");
mysql_connect($server,$username,$password);
mysql_select_db("/*my database*/" );
}
public function getPeople()
{
$result = mysql_query("SELECT * FROM awards");
$t = array();

while($row = mysql_fetch_assoc($result))
{
array_push($t, $row);
}

return $t;

}

public function add( $bestActor, $worstActor ) {

$insert = sprintf( "INSERT INTO awards VALUES (NULL, '%s', '%s')",
mysql_real_escape_string($bestActor),
mysql_real_escape_string($worstActor));

mysql_query($insert);

return 'You addded: ' . $bestActor . $worstActor . '. The Query string is: ' . $insert;
}
}

 

 

Here is the configConn.inc.php:

And finally here is the bootstrapper.php file:
[cc lang="php"]
?php

error_reporting(E_ALL | E_STRICT);
ini_set("display_errors", "on");

ini_set("include_path", ini_get("include_path") . ":'/*my path to Zend*/");

require_once Zend/Amf/Server.php';
require_once 'awards.php';

$server = new Zend_Amf_Server();

$server->setClass("awards");
// You can keep adding all the classes you need here

echo($server->handle());

?>

 

P.S. I apologize in advance for any typos due to attempting to make the code more generic.

Paceart System software simulation

Back in May of ’09, I completed the Paceart System Scheduling interactive tutorial for Medtronic it is an interactive software simulation with over one hour of narration. It was built in Flash CS3 using AS3. The entire simulator builds itself with an XML sheet. The callout text, the MP3’s and the seperate SWF’s are all called by the XML file. Here are some screen shots: