Review: Flash with Drupal

Date: Sat Apr 26 2014 Multimedia »»»» Drupal »»»» flash »»»» Drupal Planet

What does Flash have to do with Drupal? Quite a lot, potentially. Flash is the ubiquitous multimedia technology from Adobe (originally Macromedia) that enables all sorts of rich media, animation and user interface effects on websites all over the Internet. Flash is part of a multiway competition for rich user interface technology that includes advanced javascript libraries, Sliverlight, and JavaFX. For example Drupal ships bundled with jQuery, one of the javascript frameworks which can enable rich user interface effects. However stock Drupal does not make much use of jQuery's power and instead remains a relatively static page experience. But the modern audience often likes whizzy website effects and if used well rich UI technology can drastically improve website usability, and make websites look really cool.

Flash with Drupal shows you how to integrate Flash and, well, Drupal.

There are at least three forms of plausible use of Flash on a Drupal site: a) standalone Flash applets, b) Flash applets which interacts with data stored in Drupal, c) full Flash website based on data stored in Drupal. The book only covers the first two of these.

An example of a standalone applet are video players on sites like youtube. It's relatively simple to paste the embed code into a node body (such as the following youtube video), however out of the box Drupal does not allow the required , or tags. You can (as I do) add those tags to your input format configuration or there are several contributed modules to assist with safely embedding those tags. The book also does not cover using standalone flash applets such as this, instead it focuses on flash applets that interact with drupal as a backend service.

Flash with Drupal relies on a small set of contributed modules to facilitate flash applets which use drupal as a backend service.

The key contributed module is the Services module with the AMFPHP which makes it trivial to communicate between flash and any PHP backend service. The Services module enables Drupal to be treated as a data storage service and to export a web service API usable by other applications. This is a common metaphor for delivering rich internet applications in web browsers. The mashup wave from a couple years ago relied on web services API's and rich client technology on the front end. The rich client technologies were primarily implemented in javascript or flash (however Java Applets predated these newcomers by at least a decade).

The book consists of 11 chapters showing 11 progressively more in-depth projects which utilize Flash to access content in a Drupal site. In actuality most of the book has the reader sitting in the Flash IDE implementing Flash code, and very little time implementing stuff in Drupal. This perhaps demonstrates the power of Drupal as a back end service that the Services and AMFPHP modules make it straightforward to service a rich client application.

These projects start with a simple hello-world example and end with using flash to implement a five-star voting widget. Five star? Isn't there already a module for this? Yes, there is, and it probably works fine, however the author explains that this chapter exists to demonstrate building a custom service in Drupal. Additionally Flash is able to do more spiffy animation effects than Javascript (supposedly) and the author hopes to inspire the reader to think outside the box and take Flash+Drupal to greatness.

The first significant app has you define (with CCK) a Recipe content type with several fields suitable for recipes. Once you have the content type defined and the services wired up, the actionscript code required in the Flash UI exposes Drupal content in a very Drupal-like data structure. An example function is:

// Called when Drupal returns with our node.
function onNodeLoad( node:Object )
{
// print out the node title
title.text = node.title;
// print out the description
description.htmlText = node.body;
 
// show the ingredients and instructions
ingredients.text = node.field_ingredients[0]["value"];
instructions.text = node.field_instructions[0]["value"];
}

The "node" object exposed to the Flash programmer is identical in structure to the "node" object inside Drupal. This means an experienced Drupal programmer can get going in Flash programming with just a simple change of syntax from

$node->field_ingredients[0]["value"]
</span> to <span class="geshifilter">
node.field_ingredients[0]["value"]
</span>.</p><p>The book has a great amount of detail on the methods and walks you carefully through using the Flash IDE to build the required Flash applets.  There is a lot of code to wade through, most of it in the flash client rather than Drupal.</p><p>Highly recommended if you are interested in implementing rich client experiences on a Drupal site.  There are other rich client technologies than Flash which could conceivably play in this same niche, using Drupal as a backend service for a rich client.  Obviously this book is not showing ways to implement rich clients using other technologies than Flash, but it could serve as an inspiration to someone already experienced in those other technologies as to the possibilities.</p><p>This book has quite a bit in it about using the Flash IDE.  To me as a non-experienced Flash programmer I'm feeling confident this book contains enough to teach a beginners level ability with using Flash.</p><p>It appears this book has enough in it about use of the Flash IDE to help jumpstart someone to developing Flash applets.</p><p></p><!-- google_ad_section_end --><div class="sexybookmarks-default-4624"></div></object></p></body></html>