Wanted to not only learn bindings in Flex, but see how they compared to Flash in terms of actually using them and seeing their benefits side-by-side to Flash. The fact you can bind any property to any property of a GUI component rocks the mic!
So, since both of these RSS reader’s hit the same AMFPHP webservice, I figured I’d just upload the source so you could see how to use Flash & Flex with AMFPHP since there aren’t many examples around on using either, ecspecially for using RemoteObject with something other than Java, in this case PHP via AMFPHP without using the Flex server. Additionally, this is a simple enough example in Flex to see how the bindings work.
You’ll have to setup AMFPHP yourself as the SWF’s are not using the Flex server as a proxy, and thus will not work unless hosted on www.jessewarden.com because of the security sandbox. Unless you spoof this, or use AMFPHP to actually forward the request (which is easy I believe), or just setup and run localhost.
Here’s how they work:
– Flash or Flex hits the AMFPHP gateway via Flash Remoting, and calls the getRSS1Feed method in a PHP class called RSSReader.
– The RSSReader class’ method, getRSS1Feed takes 1 parameter, the URL to an RSS feed, and uses Magpie to parse it into a usable object. It then returns this object in the function.
– AMFPHP sends the object back to Flash or Flex.
– Flash or Flex then displays the RSS feeds and allows you to cycle through the blog entries.
Needless to say, the Flex one was faster to build, and more fun!
The Flash One
The Flex One
Files & Links
– Magpie PHP RSS Parser (his files need to be next to RSSReader.php in the AMFPHP “services” folder)