Registration form with Flex and AMFPHP

Source code can be found here.


Being an old Flash guy – even though I haven’t done much Flash in ages – I felt compelled to try out the new Flex product from Adobe. The purpose of this technology is that you will be able to create applications that can be run with the Flash plugin just by compiling some Actionscript that handles logic in the application and an XML derivative they call MXML to handle the display of elements with the help of styling very similar to CSS. The equivalents in the normal world of web development would be Javascript, HTML and of course CSS. We are basically talking about the Adobe version of the internet. Adding AMFPHP will give you the equivalent of Ajax in the normal web dev world.

Why the hell would you want to go through all the fuss of actually learning this tech when I basically state above that you can do everything Flex can the “normal” way? Well first of all it turns out that there is a lot of rich application stuff out of the box. Stuff that you can’t simply do within a reasonable time with Ajax. Being able to accomplish intuitive interfaces that even your granny could navigate in 5 minutes is a breeze with Flex, is it a breeze with Ajax? I don’t think so. Having said that I still believe that the usefulness of Flex is somewhat limited. It would typically work for VPN, shopping, game, trading or intranet solutions. Last I heard the Googlebot could not parse shockwaves so any kind of CMS that you want people to find is for example out of the question.

Lets get on with the tutorial! After completing Sepiroth’s introductory AMFPHP tutorial I decided to try and make something useful and why not start with a registration form complete with with some very nice validation bling? When checking out the Flex manual I noticed that I already had some basic validation logic that I easily could put in the MXML, after connecting some Actionscript to handle more advanced stuff and the connection to PHP, the Flex app was finished. Putting together a rudimentary PHP framework with models and controllers completed the whole application (don’t worry it’s all in the source you can download above).

I don’t know about you but I think laying out HTML with CSS and div tags is a real pain in the ass, even with projects like YAML I can’t seem to get it right so that all browsers like my stuff instantly. That is of course not a problem with Flex. Making RIA with Flex is definitely a hell of a lot quicker and easier than using CSS, Javascript and HTML, at least for me being an old Flash guy and all.

Related Posts

Tags: , , ,