Blog

  • Flash, Flex, & AMFPHP: RSS Reader Example

    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

    Source Files

    Magpie PHP RSS Parser (his files need to be next to RSSReader.php in the AMFPHP “services” folder)

    AMFPHP

    Flex

    Flash

  • BBC Flash Components True to Their Word

    A long, long, time ago… say, the re-election of Bush (or dumbfoundedness of the mass media depending on how you look at it), a group of dev’s at the BBC mentioned they would release their component set.

    Naturally, I figured bollocks… I’ve heard that 50 billion times before from various company representatives, and the only people to deliver were EnFlash and the Bit Components. There may be more, I’m sure, but regardless I was quite surprised to see they finally did what they said they would do.

    After creating a bunch for myself over the years, I respect anyone who can pull off releasing a set to the public. Aral’s got the 4-1-1.

  • Remote & Local Debugging in Flash & Flex

    There are a plethora of new and old tools out there to debug your Flash movies. However, just a reminder you can use Flash to see your trace statements and use your debugger while a SWF is running in a browser. Steps are as follows:

    1. Close all browsers and Flash.
    2. Go to your Flash installation directory, and look in the players directory. Mine on my PC is:
      C:\Program Files\Macromedia\Flash MX 2004\Players
    3. Make a folder called “backup”. Cut and paste the following files into it:
      • SAFlashPlayer.data
      • SAFlashPlayer.exe
      • SAFlashPlayer.rsrc
    4. Go into the debug folder, and copy the same files. Paste them one directory up, in the players folder. These are the files Flash MX 2004 Professional will utilize to make a debuggable SWF.
    5. Go back in the debug folder and install the appropriate debug player. The AX one is for IE (ActiveX), and other uses of embedded Flash, OSX for duh, exe for Firefox, and hqx for non-OSX Macs (maybe Linux? :: shrugs ::).
    6. Re-open Flash, and when compiling your FLA, make sure Debugging is enabled in your File > Publish Settings, Flash Tab > Debugging Permitted. This will ensure your SWD file, the ASCII holder of your ActionScript, will be created upon each compile. Careful, though; it has the nasty habit of caching just like ASO’s, causing the code you are debugging to be different than what’s in the SWF running. Delete if you’re paranoid like me.
    7. Open your Debugger, and ensure “Enable Remote Debugging” is on (drop down menu, top right).
    8. Finally, upload your SWF and SWD file to your server. When you hit the SWF in a browser, it’ll ask where do you want to connect; choose localhost, and go back to Flash if it doesn’t auto-focus it back for you; click OK (assuming no password), and your Output window should show traces, and your Debugger should work as normal (although a tad slower).

    This’ll work for Flex too; it comes with a debug player in:
    C:\Program Files\Macromedia\Flex\bin

    For offline debugging where Flash is embedded, such as Zinc, you can log using Afterthought.

    There are a plethora of other debugging tools as well, a lot made in Flash, but just so you know you have your standard ones by default which can be used for web deployed content.

    If you have one you know of not mentioned here, please feel free to leave a link in the comments; we’d all like to hear about it.