Book Image

Flash with Drupal

Book Image

Flash with Drupal

Overview of this book

Due to its power and expandability, Drupal has become one of the most popular open source content management systems. At the same time, Flash has been adopted for its ability to create beautiful and dynamic web applications. By combining these technologies, you can create Flash applications that are both visually stunning and rich in content. This book is an in depth discussion and tutorial on how to integrate Flash applications with Drupal CMS. It will describe the best techniques and practices for integrating Flash technology with the power and flexibility of Drupal by building real-life Flash applications. Within this book, you will learn how to build Flash applications that show text from within Drupal and also present images, music, and video within a single Flash application. You will also be able to take advantage of the expandable fields and content filtering provided from the CCK and Views modules to add flexibility and power to your Flash applications. Finally, you will learn how to add your own custom functionality to Drupal and then utilize that from within your Flash applications leaving you with a world of possibilities. This book starts out with a simple introduction to Flash and Drupal technology where you will create a simple Flash application and then embed that within Drupal. From there, each subsequent chapter builds on the previous chapters tackling a new and challenging task. For each new task, you will take a step-by-step approach to building a real-life application that utilizes the feature introduced within that chapter. You will also explore alternative design approaches that will eliminate the current design challenges that developers face when building Flash-driven Drupal sites; and all this while staying true to the Object Oriented Principles that govern the foundation of the ActionScript 3 language. By the end of this book, you will be able to apply all the lessons learned from this book to any other use case you may encounter.
Table of Contents (17 chapters)
Flash with Drupal
Credits
About the Author
About the Reviewer
Preface

Preface

This book is an in-depth discussion and tutorial session on how to integrate Flash applications with the Drupal CMS. It describes the best techniques and practices for integrating Flash technology with the power and flexibility of Drupal—by building real-life Flash applications.

In this book, you will learn how to build Flash applications that show text from within Drupal and also present images, music, and video within a single Flash application. You will also be able to take advantage of the expandable fields and content filtering provided from the CCK and Views module to add flexibility and power to your Flash applications. Finally, you will learn how to add your own custom functionality to Drupal and then utilize that from within your Flash applications, leaving you with a world of possibilities.

This book starts out as a simple introduction to Flash and Drupal technology, where you will create a simple Flash application and then embed that within Drupal. From there, each subsequent chapter will build onto the previous chapter and you will tackle new and challenging tasks. For each new task, you will take a step-by-step approach to building a real-life application that utilizes the features introduced within that chapter. You will also explore alternative design approaches that eliminate the current design challenges that developers face when building Flash-driven Drupal sites; and all this while staying true to the object-oriented principles that govern the foundation of the ActionScript 3 language. By the end of this book, you will be able to apply all the lessons learned from this book to any other use case you may encounter.

What this book covers

Chapter 1 sets the stage for the reader to learn how Flash and Drupal can combine to create a dynamic, content-rich experience for our users. We will learn how to embed Flash applications within Drupal, as well as learn about some important modules that make it easier to work with Flash in Drupal.

Chapter 2 builds a "Hello World" application. We will say hello to the world in Flash using Drupal-driven content. However, unlike any other "Hello World" tutorial, we will learn the important concepts of asynchronous programming and how that relates to working with Drupal content in Flash.

Chapter 3 covers how to add custom content to our Flash applications using the popular Content Construction Kit (CCK). We will illustrate this concept by building a hypothetical Recipe Flash application designed for a Drupal cooking web site.

Chapter 4 shows us how to use Drupal managed images to give our application a little visual flare as a visually stunning Flash application would not be complete without the integration of images. We will build on from the previous chapter by adding an image to our Recipe Flash application.

Chapter 5 explores how to use Drupal to manage a list of audio nodes and also builds a Flash application to play that music. When it comes to multimedia, Flash is the portal of choice for playing audio on a web sites.

Chapter 6 expands our custom media player to not only play music, but also show Flash videos managed from our Drupal web site, which is built onto the concept from the previous chapter. In addition, we will learn some important concepts of object-oriented practices while we reuse common components to build a media player for Drupal.

Chapter 7 explains the basics of how to take an existing Flash application and break apart the components for remote communication. We achieve this by first abstracting out separate functionalities into two separate components, and then laying the foundation for a communication gateway between the two different components. This is an essential first step to create a robust and easily maintained system, where Flash applications can be separated on a Drupal web site, thus implementing a hybrid Flash integration approach.

Chapter 8 creates the necessary components required to implement the hybrid approach. This chapter focuses on creating the bridge between two different Flash applications. Once we create this bridge, we will have the ability to control our media from a remote Flash application. In other words, we will be building a remote control for our media player that can be placed anywhere on the page, separate from the media player.

Chapter 9 builds a media player whose playlist is driven from the power of the Drupal Views module. Arguably, the most important aspect of any content-rich web site is its ability to build lists of each piece of content in a meaningful manner. The Drupal Views module gives the administrator the ability to manage the contents of their site in a meaningful list of content to present to the users. By combining this power within Flash, we can learn how to create a playlist of video nodes for our custom media player.

Chapter 10 shows how to utilize user management within a Flash application by building a User Login Flash widget. One of the most important aspects of the Drupal CMS is its ability to manage its users and protect the content of that site using a permission-based role system.

Chapter 11 shows how to add content to our Drupal web site while at the same time keep our data safe from malicious software. Not only can Flash be used to show Drupal content, but it can also be utilized to add and manipulate Drupal content from a remote Flash application.

Chapter 12 will sum up all lessons learned in this book by building a five-star voting mechanism in Flash. We will learn how to build a custom Voting Service as well as create our very own Flash driven five-star voter compatible with the popular FiveStar module.

What you need for this book

We need to install Drupal version 6, Flash CS3 or CS4, and Apache-MySQL-PHP (AMP) for this book.

Who this book is for

This book is written for developers who wish to build dynamic Flash applications. Although, we will be using Drupal for our Content Management System, the lessons learned within this book can easily be applied to other content management systems such as Joomla or WordPress. Because of this, you are not required to be familiar with Drupal. Any interaction with Drupal will be described in full detail so that anyone can follow along. As for Flash, it is not necessary to be familiar with how to use Flash since that too will be covered in this book. However, it is recommended that you have some modest understanding of ActionScript and PHP since there are many code examples in this book.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We can start this off by opening up our main.as file and then, shift our focus to the onNodeLoad function."

A block of code will be set as follows:

// Called when Drupal returns with our node.
function onNodeLoad( node:Object )
{
// Print out the node title.
title.text = node.title;
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be shown in bold:

// Declare our variables
var baseURL:String = "http://localhost/drupal6";
var gateway:String = baseURL + "/services/amfphp"
var sessionId:String = "";
var nodeId:Number = 5;

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to , and mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note via the SUGGEST A TITLE form on www.packtpub.com, or send an email to .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book on, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code for the book

Visit http://www.packtpub.com/files/code/7580_Code.zip to directly download the example code.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us to improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately, so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of this book, and we will do our best to address it.