Viewing items tagged with: AS3

Please Log In or Register

Parsons Exploratory Navigation

Recently Parsons has launched a much needed improved site. I worked on a Flash application of the site which serves as an exploratory navigation for potential students to discover programs they may be interested in based on floating keywords. The design was done by Dexter Miranda and supervised by Isa Gouverneur, both part of the Parsons creative team. The navigation also visually makes connections between programs or schools that share keywords. This is slightly confusing to explain, so take a look at the navigation itself.

MORE INFO


AMFPHP 1.9 and Actionscript 3

I recently installed amfphp 1.9 and have gotten it to work thanks to some tutorials by Lee Brimelow on some introductions to amfphp.

Introduction to AMFPHP 1
Introduction to AMFPHP 2

He also did a blog post about some security issues regarding amfphp. These were great to get me started, but I ran into a few problems when I began to play around with it on my own.

First, I always place some returns at the top of my documents just for some space. However, this caused Flash to return a Server.badCall error, so make sure that there are no extra returns at the top of your document.

I had trouble finding the data that the responder returns by using the method that Lee described, but I found that if the amfphp function returns a single value, like “false” or “0”, then you can access it through :

function onTotal(responds:Object):void {
total = int( responds.serverInfo.initialData );
}

If you are dealing with a function that returns multiple values, such as a query to a database, I found that you can cycle through the results with this :

function onGetUserInfo(responds:Object):void {
for (var i:int = 0; i < responds.serverInfo.initialData.length; i++) { trace(responds.serverInfo.initialData[i]);
trace(responds.serverInfo.initialData[i][0]);
}
}

Another problem that I ran into was the calls returning null values. This was due to the fact that I was directly referencing the file name.
i.e. http://www.site.com/amfphp/gateway.php. This worked when the user was at www.site.com, however, when the user accessed the swf from site.com it would return null values. I found that a quick fix was to simply reference the gateway through “/amfphp/gateway.php”.

Lee chose to display examples from php 5 and the constructor function for the class that he mentions for php 5 is
public function __construct() {}
}
?>

If you are using php 4, the constructor function of the class is the same name as the class that contains it
function DB() {}
}?>

I am not very good at php so I hope that this helps someone, as some of these errors were tough to spot, mainly the class constructor and the url with www or not.