August 6th, 2008 . by polygeek
Most of this tutorial is concerned with phpMyAdmin to create a database, table and user. Then we’ll write a PHP service that will connect and read/write data to the table we created. You can see an example of what we’ll create in the Flex app below.
AMFPHP tutorial index
One thing that I meant to cover but spaced was creating a dbConnection.php file that holds your mysql_connect statements. Instead of leaving those statements in the constructor like I did here:
function Blogroll() { // this is the constructor for the 'Blogroll' class
$mysql = mysql_connect( "localhost", "myUsername", "myPassword" );
mysql_select_db( "myDatabase" );
}
You can put that statement in an external file, I call mine dbConnection.php. That way you can refer to that file in all your services and if you need to update your connection statement you’ll only need to access one file. Plus, presumably, it’s more secure.
So in the end your constructor would look like this:
function Blogroll() {
include("dbConnection.php");
}
And your connection file would look like this:
<?php
$mysql = mysql_connect( "localhost", "myUsername", "myPassword" );
mysql_select_db( "myDatabase" );
?>
Please comment below if you have any input on how this video tutorial could be better. I’ll re-record this tutorial when I feel that I’ve gotten enough feedback to make some quality improvements.
Posted in AMFPHP, Flex Tutorial, video tutorial
|
2 Comments »
August 6th, 2008 . by polygeek
This tutorial - 8.5 minutes long - focuses on setting up a Flex project to send/receive data via AMFPHP.
AMFPHP tutorial index
The source files contain the services-config.xml file so that you can drop that into your AMFPHP Flex projects. And the additional command line argument that you need to add to your project is: -services “services-config.xml”.
Sorry I flew through the creating a user/permissions section. It isn’t something I do very often so I was a bit lost myself. I’ll do it better in the next version.
Please comment below if you have any input on how this video tutorial could be better. I’ll re-record this tutorial when I feel that I’ve gotten enough feedback to make some quality improvements.
Posted in AMFPHP, Flex Tutorial, video tutorial
|
No Comments »
August 6th, 2008 . by polygeek
This is a short, 153 second, video on setting up AMFPHP. I’m doing this on Windows XP but the details aren’t much different for OS-X.
AMFPHP tutorial index
Lee Brimelow has a much more detailed setup in his first AMFPHP tutorial at GotoAndLearn.com. You should check that out if you have any problems. His code sample uses the NetConnection approach with Actionscript 3. I’m using the <RemoteObject> approach which is part of the Flex framework.
Please comment below if you have any input on how this video tutorial could be better. I’ll re-record this tutorial when I feel that I’ve gotten enough feedback to make some quality improvements.
Posted in AMFPHP, Flex Tutorial, video tutorial
|
No Comments »
July 1st, 2008 . by polygeek
Unless you’ve been hiding under a MSN search box you’ve heard the news that Adobe has worked with Google and Yahoo to make SWF files truly indexable by search engine spiders.
I’ve put together a quick Flex application this morning to take this new feature for a test drive. It’s just a TabNavigator displaying a few tabs of content about Greek gods. My goal isn’t to become the number one result for zeus. I just want to see the content get indexed and see what the search results look like.

If you would like to help out with this little experiment then try linking to the application so that it might get crawled sooner. Wouldn’t it be cool if this little experiment ended up being on Google’s first page for “greek gods zeus”? I’ll do a site-search every few days to see when it gets indexed and report back in another post when it does.
I pulled the content off of the Wikipedia.org site and dropped it into a database here at polyGeek.com. Then I used AMFPHP to grab the data and create as many tabs in the TabNavigator as there are results. And I added toolTips to the images if you mouse over them.
The nice thing about the TabNavigator is that the BrowserManager is automatically engaged. And I wrote 3 lines of code to enable the deepLinking in the app so you can land directly on a specific tab depending on the URL. And as always, mi coda, su coda.
In the code I’ve added the SQL, images, and my GoRemote.mxml to help you recreate this if you want. You’ll just need to get AMFPHP going yourself and add my AMFdata.php file to the ../services/amfphp/ folder. I might cover all the more in depth in a later post, someday.
Addendum: I just read the blog post at Google and it mentions that
Googlebot does not execute some types of JavaScript. So if your web page loads a Flash file via JavaScript, Google may not be aware of that Flash file…
I’m using the default Javascript/HTML code that FlexBuilder creates. So I’ll see if it gets indexed. And if you’re wondering why I use the default FB code it’s because I’m too lazy to take the additional step of using SWFobject, most of the time. :-)
Posted in AMFPHP, Adobe News, Flex Tutorial, SEO
|
10 Comments »
May 26th, 2008 . by polygeek
I have a new poll in my sidebar to the right that uses AMFPHP to read/write data to a MySQL database. The poll itself is based on an XML file. The Flex app reads the XML file and looks for the database/table that the XML file indicates. The nice thing is that if either the database or table don’t exist then the Flex app creates them.
So to make another poll all I have to do is create a new XML file and point at it. No messing around with MySQL admin and creating tables and such. Not that it’s hard but changing a few lines of XML is way easier. And in true geek manner I spent hours making the Flex app create everything from scratch rather than spend a few minutes here and there doing it manually.
The poll also stores your vote in a SharedObject so that you can only vote once. In the chart your vote choice is exploded out a bit. And as you roll over the labels in the poll results it dynamically explodes out that wedge of the chart.
If anyone has any suggestions for improvement let me know. I intend to tweak it a bit and release the code for others to use. Ultimately I think even people who have zero Flex/Actionscript experience should be able to implement this on their blog.
Oh, and don’t forget to vote.
Posted in AMFPHP, Flex Tutorial
|
5 Comments »