{"id":39,"date":"2010-05-18T13:47:38","date_gmt":"2010-05-18T18:47:38","guid":{"rendered":"https:\/\/www.flom.com\/?p=39"},"modified":"2025-11-04T15:14:41","modified_gmt":"2025-11-04T21:14:41","slug":"flash-builderflex-4-and-zendamf-alternative-connection-example","status":"publish","type":"post","link":"https:\/\/www.flom.com\/?p=39","title":{"rendered":"Flash Builder\/Flex 4 and ZendAMF alternative connection example"},"content":{"rendered":"<p>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.\u00a0 The example I was following was from an article over at the Zend Developer Zone called: <a href=\"http:\/\/devzone.zend.com\/article\/4705\" target=\"_blank\" rel=\"noopener\">Data-centric Adobe Flash Builder development with the Zend Framework<\/a>. 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\u00a0get\u00a0it to\u00a0work.\u00a0 I decided to incorporate the simple example <a href=\"http:\/\/www.leebrimelow.com\">Lee Brimelow<\/a>\u00a0used with his <a href=\"http:\/\/www.gotoandlearn.com\/play?id=90\" target=\"_blank\" rel=\"noopener\">Flash and Zend AMF tutorial<\/a>.<\/p>\n<p>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.<\/p>\n<p>&nbsp;<\/p>\n<p>Here is the awards.php file:<\/p>\n<pre class=\"lang:php decode:true\" title=\"1st chunk\">class awards {\r\npublic function __construct()\r\n{\r\nrequire(\"\/*path to file outside of public web directory*\/configConn.inc.php\");\r\nmysql_connect($server,$username,$password);\r\nmysql_select_db(\"\/*my database*\/\" );\r\n}\r\npublic function getPeople()\r\n{\r\n$result = mysql_query(\"SELECT * FROM awards\");\r\n$t = array();\r\n\r\nwhile($row = mysql_fetch_assoc($result))\r\n{\r\narray_push($t, $row);\r\n}\r\n\r\nreturn $t;\r\n\r\n}\r\n\r\npublic function add( $bestActor, $worstActor ) {\r\n\r\n$insert = sprintf( \"INSERT INTO awards VALUES (NULL, '%s', '%s')\",\r\nmysql_real_escape_string($bestActor),\r\nmysql_real_escape_string($worstActor));\r\n\r\nmysql_query($insert);\r\n\r\nreturn 'You addded: ' . $bestActor . $worstActor . '. The Query string is: ' . $insert;\r\n}\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Here is the configConn.inc.php:<\/p>\n<pre class=\"lang:php decode:true \" title=\"2nd chunk\">And finally here is the bootstrapper.php file:\r\n[cc lang=\"php\"]\r\n?php\r\n\r\nerror_reporting(E_ALL | E_STRICT);\r\nini_set(\"display_errors\", \"on\");\r\n\r\nini_set(\"include_path\", ini_get(\"include_path\") . \":'\/*my path to Zend*\/\");\r\n\r\nrequire_once Zend\/Amf\/Server.php';\r\nrequire_once 'awards.php';\r\n\r\n$server = new Zend_Amf_Server();\r\n\r\n$server-&gt;setClass(\"awards\");\r\n\/\/ You can keep adding all the classes you need here\r\n\r\necho($server-&gt;handle());\r\n\r\n?&gt;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>P.S. I apologize in advance for any typos due to attempting to make the code more generic.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was attempting to try out a simple test of ZendAMF and Flash Builder. I had begun by building the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":505,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[5,3,6],"tags":[],"class_list":["post-39","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-actionscript","category-flash","category-flex"],"uagb_featured_image_src":{"full":["https:\/\/www.flom.com\/wp-content\/uploads\/2010\/05\/image-e04b65e1-3153-4a7b-835e-91fdad74e893.png",1024,1024,false],"thumbnail":["https:\/\/www.flom.com\/wp-content\/uploads\/2010\/05\/image-e04b65e1-3153-4a7b-835e-91fdad74e893-150x150.png",150,150,true],"medium":["https:\/\/www.flom.com\/wp-content\/uploads\/2010\/05\/image-e04b65e1-3153-4a7b-835e-91fdad74e893-300x300.png",300,300,true],"medium_large":["https:\/\/www.flom.com\/wp-content\/uploads\/2010\/05\/image-e04b65e1-3153-4a7b-835e-91fdad74e893-768x768.png",768,768,true],"large":["https:\/\/www.flom.com\/wp-content\/uploads\/2010\/05\/image-e04b65e1-3153-4a7b-835e-91fdad74e893.png",1024,1024,false],"1536x1536":["https:\/\/www.flom.com\/wp-content\/uploads\/2010\/05\/image-e04b65e1-3153-4a7b-835e-91fdad74e893.png",1024,1024,false],"2048x2048":["https:\/\/www.flom.com\/wp-content\/uploads\/2010\/05\/image-e04b65e1-3153-4a7b-835e-91fdad74e893.png",1024,1024,false]},"uagb_author_info":{"display_name":"Todd Flom","author_link":"https:\/\/www.flom.com\/?author=1"},"uagb_comment_info":0,"uagb_excerpt":"I was attempting to try out a simple test of ZendAMF and Flash Builder. I had begun by building the [&hellip;]","_links":{"self":[{"href":"https:\/\/www.flom.com\/index.php?rest_route=\/wp\/v2\/posts\/39","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flom.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flom.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flom.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=39"}],"version-history":[{"count":27,"href":"https:\/\/www.flom.com\/index.php?rest_route=\/wp\/v2\/posts\/39\/revisions"}],"predecessor-version":[{"id":506,"href":"https:\/\/www.flom.com\/index.php?rest_route=\/wp\/v2\/posts\/39\/revisions\/506"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.flom.com\/index.php?rest_route=\/wp\/v2\/media\/505"}],"wp:attachment":[{"href":"https:\/\/www.flom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=39"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=39"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flom.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=39"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}