Flash with Drupal


Flash with Drupal
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$18.89
save 30%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$40.49
save 44%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Reviews
Support
Sample Chapters
  • Learn to integrate Flash applications with Drupal CMS
  • Explore a new approach where Flash and HTML components are intermixed to provide a hybrid Flash-Drupal architecture
  • Build a custom audio and video player in Flash and link it to Drupal
  • Build a Flash driven 5-star voting system for Drupal at the end of the book

Book Details

Language : English
Paperback : 380 pages [ 235mm x 191mm ]
Release Date : May 2009
ISBN : 1847197582
ISBN 13 : 9781847197580
Author(s) : Travis Tidwell
Topics and Technologies : All Books, CMS and eCommerce, Flash, Content Management (CMS), Drupal, Open Source

Back to BOOK PAGE

Table of Contents

Preface
Chapter 1: Flash with Drupal
Chapter 2: Building a "Hello World" Application
Chapter 3: Flash and CCK
Chapter 4: Drupal Images in Flash
Chapter 5: Drupal Audio in Flash
Chapter 6: Flash Video in Drupal
Chapter 7: The Hybrid Approach Part 1: Componentization
Chapter 8: The Hybrid Approach Part 2: Remote Control
Chapter 9: Flash with Drupal Views
Chapter 10: User Management
Chapter 11: Adding Content to Drupal
Chapter 12: Build a Drupal Five-star Voter in Flash
Index
  • Chapter 1: Flash with Drupal
    • Why Flash with Drupal?
    • Who is this book for?
    • Getting started with Drupal
      • Installing Drupal
        • Installing Apache-MySQL-PHP (AMP)
        • Creating the Drupal database
        • Creating a database user
        • Increasing PHP memory
        • Installing Drupal
      • Adding content to Drupal
    • Getting started with Flash
      • Creating a new Flash project
        • Setting up the workspace
        • A: The Stage
        • B: The Toolbar
        • C: The Timeline
        • D: The Properties panel
        • E: The Color Palette
        • F: The Library
    • Creating a Flash application
      • Creating a background
        • Rectangle properties
        • Adding a gradient
      • Adding text to a Flash application
        • Text properties
      • Compiling our Flash application (making a SWF)
        • Publish Settings
    • Adding Flash content to Drupal
      • Installing a contributed Drupal module
      • Adding Flash!
    • Summary
  • Chapter 2: Building a "Hello World" Application
    • How Flash and Drupal communicate
      • Understanding web services
        • Synchronous versus asynchronous programming
      • Setting up Drupal for web services
        • Installing and configuring the Services module
        • Servers and Services
        • Installing AMFPHP
        • Services configuration
        • Creating a Services key
        • Services settings
        • Service Permissions
      • Building a web service-driven "Hello World" application in Flash
        • Step 1: Creating our Flash application
        • Step 2: Creating a main.as ActionScript file
        • Step 3: Connecting to Drupal
        • Step 4: Session handling
        • Connecting to Drupal using system.connect
        • Step 5: Drupal says "Hello World"
        • Loading a node in Flash
        • Step 6: Hooking up the text
        • Step 7: Passing the node ID using FlashVars
        • Step 8: Adding it to Drupal
    • Summary
  • Chapter 3: Flash and CCK
    • Overview of a typical recipe web site
    • Using Drupal's Content Construction Kit
      • Creating a new content type
      • Adding custom fields to your Recipe content type
        • Adding a new field
        • Changing the default Body field
    • Showing CCK fields in Flash
      • Building a Recipe widget in Flash
      • Adding dynamic TextFields for Drupal content
      • Using ActionScript to show Drupal CCK fields
        • Using the Services Administrator
        • Showing CCK information in ActionScript
        • Adding ScrollBars to our TextFields
    • Creating a Drupal node template for Flash
      • Using the Content Template module (Contemplate)
    • Summary
  • Chapter 4: Drupal Images in Flash
    • Image handling in Drupal
      • ImageField for CCK
      • Installing the ImageField module
        • Adding an Image field to our Recipe content type
        • Adding an image to our Recipe node
        • Verifying that the image is attached
      • Adding an image to our Recipe Flash application
        • Adding a MovieClip container for our image
        • Using ActionScript to load the Recipe image
      • Resizing an image
      • Preserving the width and height ratio (scaling)
      • Using Drupal's ImageCache with Flash
        • Creating an ImageCache preset
        • Adding an ImageCache image in Flash
      • Adding the new Recipe Flash application to Drupal
    • Summary
  • Chapter 5: Drupal Audio in Flash
    • Working with audio in Drupal
      • Installing the getID3 library
      • Setting up the Audio content type
      • Creating an Audio node
      • How our player will be different (and better)
    • Building a custom audio player for Drupal
      • Examining the Audio node using Services Administrator
      • Referencing the audio file path
      • Writing a custom AudioPlayer class
      • Playing audio in Flash
      • Using our AudioPlayer class to play audio
    • Adding controls to your custom audio player
      • Adding a play and pause button
        • Creating a base button MovieClip
        • Adding the PlayButton movie clip
      • Creating a pause button from the play button
      • Linking MovieClips to ActionScript
      • Adding the AudioPlayer to the stage
      • Modifying the AudioPlayer class to use play and pause
        • Step 1: Adding the SoundChannel
        • Step 2: Adding load, play, and pause functions
        • Step 3: Reference the mcAudioPlayer MovieClip
        • Step 4: Hooking up our buttons!
      • Modifying our main.as file to use our new AudioPlayer
    • Summary
  • Chapter 6: Flash Video in Drupal
    • Working with video in Drupal
      • Creating a video content type
        • Adding a video file field
      • Installing and configuring the jQuery Media module
        • Configuring the jQuery Media module
        • Installing a media player
      • Creating a video node
      • Building a custom video player in Flash
        • Creating a MediaPlayer base class
        • Adding play and pause button instances to MediaPlayer
        • Removing uncommon code from MediaPlayer
        • Modifying the AudioPlayer class to derive from MediaPlayer
        • Extending and overriding base (super) class functionality
        • Creating a VideoPlayer class
        • Working with Video, NetStream, and NetConnection
        • Initializing our video variables
        • Creating the video object
      • Adding video functionality
        • Adding video load
        • Adding play and pause functionality
      • Creating a new VideoPlayer MovieClip
      • Linking the VideoPlayer to Drupal
        • Loading and playing our Drupal video
      • Adding our custom media player to Drupal
    • Summary
  • Chapter 7: The Hybrid Approach Part 1: Componentization
    • What is the hybrid approach?
    • Creating a media player control bar
      • Creating a ControlBar class
      • Removing the ControlBar dependency from MediaPlayer
      • Adding the ControlBar to the stage
      • Communication between ControlBar and MediaPlayer
    • Creating a communication gateway
      • Using static functions
        • Using the this pointer
        • Making the connections
      • Adding the ControlBar to our Flash project
        • Removing the control bar from the MediaPlayer
    • Summary
  • Chapter 8: The Hybrid Approach Part 2: Remote Control
    • Client-side Flash communication
      • Flash to JavaScript communication
        • Calling a JavaScript function from Flash
        • Calling a Flash function from JavaScript
        • Initializing the ExternalInterface
        • Adding the MediaGateway initialization to main.as
        • Adding outgoing messages to the MediaGateway
        • Adding remote or local functionality
      • Building a JavaScript Gateway
        • Locating a Flash application using JavaScript
        • Creating the gateway functions between two Flash applications
      • Flash and JavaScript synchronization
        • Step 1: Create an array of communicating Flash applications
        • Step 2: Flash calls to see if the JavaScript Gateway is ready
        • Step 3: Flash application registers with JavaScript
        • Step 4: JavaScript initializes our Flash when all have registered
      • Using our remote control within Drupal
        • Adding the JavaScript Gateway to Drupal
        • Adding our Media Player to Drupal
        • Changing our Content Template
        • Adding the Remote Control
        • Creating a FlashNode template
    • Summary
  • Chapter 9: Flash with Drupal Views
    • Using the Drupal Views module
      • Views: Installation and Configuration
      • Setting up a view
        • Creating a new page view
        • Adding fields to a view
        • Adding a Filter to our view
    • Using the Views Service
      • Step 1: Install the Views Service
      • Step 2: Configure user permissions
      • Step 3: Verify it works
    • Building a Flash Playlist using Drupal
      • Creating a node teaser
        • Creating a teaser background
        • Using the timeline to add different teaser states
        • Adding a title to the teaser
      • Creating a Teaser class
      • Building a ListView class
        • Adding our ListView to Flash
      • Adding the ListView to our Media Player
        • Creating a Media Region
        • Populating the list view
    • Summary
  • Chapter 10: User Management
    • Drupal user management
      • Adding new user roles
      • Adding permissions to a user role
      • Creating new users and assigning them roles
    • The User Service module
      • Installing the User Service
      • Configuring permissions
      • Configuring the User Service module
  • Building a Flash user login block
    • Welcoming our logged-in users
    • Creating a login button
    • Adding some status text
    • Creating a mcLogin movie clip
  • User handling within Flash
    • Hooking up our login button
    • Checking for a username and password
  • Logging into Drupal
    • Adding a user responder
    • Logging in
    • Logging out
  • Summary
  • Chapter 11: Adding Content to Drupal
    • Drupal Services security
      • The API key
        • API key configuration
        • The allowed domain and crossdomain.xml
        • How to use the API key
      • Building a Drupal service in Flash
      • The DrupalService class
        • Adding the API key to our DrupalService
        • Adding arguments to the service call
      • Adding DrupalService functionality to main.as
    • Building a node editor in Flash
      • Creating view, edit, and add tabs
        • Adding normal, hover, and selected states
        • Duplicating the mcView for the edit and add tabs
      • Adding a background to our node
      • Changing the node view
      • Creating a node edit form
    • Adding content to Drupal from Flash
      • Adding tab functionality
      • Saving a node from Flash
    • Editing existing content in Drupal
    • Summary
  • Chapter 12: Build a Drupal Five-star Voter in Flash
    • Building a custom Voting Service for Drupal
      • The module info file
      • Voting Service module
        • Installing the Voting Service module
      • Building a Custom Service
        • Registering external web services using hook_service
        • Defining web service callback functions
        • Adding arguments and voting logic using Voting API
    • Building a five-star voter in Flash
      • Voter design
        • Making some stars
        • Adding different vote types
        • Adding the vote layers to the mask layer
        • Adding vote hit regions
    • Creating a Voter class in ActionScript
      • Initializing the voter
      • Adding the event handlers
      • Handling the voting hover events
      • Getting a vote from Drupal
      • Setting a vote in Drupal
      • Adding the voters to main.as
    • Summary
Back to BOOK PAGE

Travis Tidwell

Travis Tidwell is the founder and CTO for TMT Digital (http://www.tmtdigital.com), a company that specializes in the development of Flash applications for the Drupal content management system. He is also the sole developer for the Dash Media Player (http://www.tmtdigital.com/project/dash_player, http://www.drupal.org/project/dashplayer), which is a media player built specifically for Drupal. As well as contributing this media player, Travis is also the author and co-maintainer for the FlashVideo module (http://www.drupal.org/project/flashvideo), which is a complete video solution for Drupal.

Travis graduated with a Bachelors of Science in Electrical and Computer Engineering from Oklahoma State University and has worked as an Embedded Systems Engineer for companies specializing in automotive and agricultural GPS products. Travis then fell in love with web development and more specifically with Drupal and Flash, where he has developed numerous sites including http://www.delicioso.com for Food Network's Ingrid Hoffmann.

Travis is happily married to his beautiful wife, Erin, and is the proud parent of a feisty one-year-old named Brycen. When Travis isn't working on the computer (which is rare these days), he enjoys the performing arts including playing guitar, singing, and tap dancing (Search for "Soul Man Tap" at http://www.youtube.com to see him in action).

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 9 submitted: last submission 10 Sep 2012

Errata type: Other | Page number: 0

Since the book has been published, there have been several changes made to the Services module that might cause some issues when following along with the book. In the book, used Services 6x.0.13 are used, which can be found by downloaded at the following location: http://ftp.drupal.org/files/projects/services-6.x-0.13.tar.gz Since then, a new version has been released ( Services 6x.0.14 ) which seems to have a minor bug where the Keys tab does not show up when you first install the module. If you are using this version, then the quick fix for this is to click on the Settings tab in the Services Administrator, and then uncheck the Use Keys checkbox, and then re-check it ( basically toggling the checkbox ). You should then see the Keys tab appear. There is also a new development version of the Services module ( Services 6x. 2.x-dev ). It is not recommended ot use this module at this time, but if you wish to use this version, then you will need to install a new module called Keys Authorization. Once this module has been installed, you will then need to temporarily disable the keys for the first several chapters by navigating to the Settings page in the Services Administrator and then uncheck the Use Keys checkbox. The reason for this is because the latest version requires the API key to be provided within the node.get routine, which we don't cover until Chapter 11.

 

Errata type: Other | Page number:0

Within Chapter 5, there is a possibility that you will run into many errors when you run the application that says... "Access of undefined property playButton." This is caused because within the Chapter on page 120, I tell the reader to add the line... var player:AudioPlayer = new AudioPlayer(); However, on page 136, I do not indicate that this line needs to be removed. To fix this error, you simply need to remove this line from the main.as file.

 

Errata type:Technical | Page number:40

Administer | Services should be Administer | Site building | Services

 

Errata type:Technical | Page number:43

Administer | Permissions section within the User Settings section should be Administer | User management | Permissions

 

Errata type:Technical | Page number:44

Save User permissions should be Save permissions

 

Errata type:Code error | Page number:160

Description: Code should read video = new Video(stage.stageWidth, stage.stageHeight);

 

Errata type:Code error | Page number:297

var gateway:String = baseURL + "/services/amfphp" should be: var gateway:String = baseURL + "/services/amfphp";

 

Errata type: Other | Page number:0

Within Chapter 5, there is a possibility that you will run into many errors when you run the application that says... "Access of undefined property playButton." This is caused because within the Chapter on page 120, I tell the reader to add the line... var player:AudioPlayer = new AudioPlayer(); However, on page 136, I do not indicate that this line needs to be removed. To fix this error, you simply need to remove this line from the main.as file.

 

Errata type:Technical | Page number:40

Administer | Services should be Administer | Site building | Services

 

Errata type:Technical | Page number:43

Administer | Permissions section within the User Settings section should be Administer | User management | Permissions

 

Errata type:Technical | Page number:44

Save User permissions should be Save permissions

 

Errata type:Code error | Page number:160

Description: Code should read video = new Video(stage.stageWidth, stage.stageHeight);

 

Errata type:Code error | Page number:297

var gateway:String = baseURL + "/services/amfphp" should be: var gateway:String = baseURL + "/services/amfphp";

 

Errata type: Others | Page number: 201 | Errata date: 20 April 10

Ok this is a little complicated to explain so please bear with me. Look at page 220. In the screenshot there are two play buttons in other words there are two ControlBars. There is a 'player' ControlBar and a 'remote' ControlBar. Now when I press the play button on the 'player' ControlBar, it calls MediaGateway.playMedia(true). Now see the playMedia function on page 199. The 'external' boolean is set to true. The 'connect' variable will be set to 'remote' and the component is ready. So the ExternalInterface.call code will be executed and playMedia will be tried to be executed on the remote control bar. But there is no media player on the remote! In other words, the local remote still seems to be sending commands to the remote MediaPlayer (which is not there). It should send it to the local media player. When an addControlBar function (in main.as) is called the ControlBar should should be told that it needs to communicate remotely or locally with a MediaPlayer. That seems to be absent.

 

Errata type:other | Page number:289

<= 8) { var argsApplied:Array = [command, responder].concat(args); call.apply(this, argsApplied); } else { trace("Too many arguments in DrupalService"); }

 

 

 

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Flash with Drupal +    Learning Geospatial Analysis with Python =
50% Off
the second eBook
Price for both: $39.00

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Understand how Flash and Drupal communicate
  • Embed Flash applications within Drupal and also learn about the important modules that make it easier to work with Flash in Drupal
  • Learn the asynchronous programming techniques for Drupal's web services
  • Set up Drupal for web services using the services module to handle external interaction
  • Create a custom recipe content type for your Flash application and add new fields and images to it
  • Use Drupal's imageCache module with Flash to ensure that the images are not too large when loaded into our application
  • Create an audio-handling class using ActionScript 3
  • Load and play audio in Flash, and add user controls like on and off
  • Utilize Object Oriented techniques in ActionScript 3 to build a common MediaPlayer class to be used for both audio and video applications
  • Create a playlist of video nodes for our custom media player using Drupal Views
  • Utilize user management within a Flash application to manage its users and protect the content of the site with a permission-based role system
  • Add content to the Drupal web site and also keep it safe from malicious software
  • Build a custom voting service and create a Flash-driven 5-star voter for Drupal using the popular FiveStar module

In Detail

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.

A hands-on learning approach to building Flash applications for Drupal

Approach

This book takes a step-by-step approach to building Flash applications for use with the Drupal Content Management System. In each chapter, you walk through the evolution of a real Flash application designed for Drupal. Every chapter builds on the previous one by presenting a more challenging feature for each additional chapter.

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 assumed 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 within this book. However, it is recommended that you have some modest understanding of ActionScript and PHP since there are many code examples within this book.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software