E-book details

Flash with Drupal. Build dynamic, content-rich Flash CS3 and CS4 applications for Drupal 6

Flash with Drupal. Build dynamic, content-rich Flash CS3 and CS4 applications for Drupal 6

Travis Tidwell, Dries Buytaert

Ebook
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.
  • Flash with Drupal
    • Table of Contents
    • Flash with Drupal
    • Credits
    • About the Author
    • About the Reviewer
    • Preface
      • What this book covers
      • What you need for this book
      • Who this book is for
      • Conventions
      • Reader feedback
      • Customer support
        • Downloading the example code for the book
        • Errata
        • Piracy
        • Questions
    • 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
    • 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
            • Using the NetConnection class
            • Connecting to a remote gateway
            • Using the NetConnection call routine
          • Step 4: Session handling
          • Connecting to Drupal using system.connect
          • Step 5: Drupal says "Hello World"
          • Loading a node in Flash
            • Programming without race conditions
          • Step 6: Hooking up the text
          • Step 7: Passing the node ID using FlashVars
            • Using FlashVars in a Flash application
          • Step 8: Adding it to Drupal
      • Summary
    • 3. Flash and CCK
      • Overview of a typical recipe web site
      • Using Drupals 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
            • Showing the node description
            • Showing the ingredients and instructions CCK field
          • Adding ScrollBars to our TextFields
      • Creating a Drupal node template for Flash
        • Using the Content Template module (Contemplate)
      • Summary
    • 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
            • Working with the Image path
            • Creating a loadImage function
            • Loading an 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
            • Changing our ActionScript for ImageCache
        • Adding the new Recipe Flash application to Drupal
      • Summary
    • 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
            • Drawing a play icon
        • 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!
            • Declaring playButton and pauseButton as buttons
        • Modifying our main.as file to use our new AudioPlayer
      • Summary
    • 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
    • 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
    • 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
            • Adding block visibility for video and audio node types
          • Creating a FlashNode template
      • Summary
    • 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
    • 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
    • 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 the base URL
            • Adding the TimeStamp
            • Adding the nonce
            • Adding a hash
        • 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
    • 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
            • The Voting API module
      • 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
            • Using name conventions
      • 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
    • Index
  • Title: Flash with Drupal. Build dynamic, content-rich Flash CS3 and CS4 applications for Drupal 6
  • Author: Travis Tidwell, Dries Buytaert
  • Original title: Flash with Drupal. Build dynamic, content-rich Flash CS3 and CS4 applications for Drupal 6
  • ISBN: 9781847197597, 9781847197597
  • Date of issue: 2009-05-27
  • Format: Ebook
  • Item ID: e_3b2v
  • Publisher: Packt Publishing