Creating a Drupal node template for Flash

Moving back to Drupal, our next task is to take our compiled Recipe Flash application and integrate it into our Drupal system. We will start out by doing the same thing we did in the previous chapters, and add our Flash application to our Drupal web site using the FlashNode module. We can do this by simply going to Create Content Flash, and then selecting our new SWF file where it asks for the Flash file. We can then click on the Save button to submit this Flash application to our Drupal...

Adding our custom media player to Drupal

The first step we will need to take is to change our nodeid variable back to the FlashVars format so that we can compile our new media player for Drupal. var baseURL String http localhost drupal6 var gateway String baseURL + services amfphp var sessionId String var nodeId Number root.loaderInfo.parameters.node After we run our media player with these changes (which compiles the SWF file), we can follow the steps from Chapter 4 and upload our new media player by navigating to Create Content...

Info

After we have our scroll bars in place, the next step is to click on each one of them and give them an instance name using the Properties panel. We will call each one ingredientScroll and instructionScroll respectively. Now that our scroll bars have instance names, we can add some simple code to our onNodeLoad function so that each scroll bar will refresh as the text is populated within them. We can do this by calling the update function on each UIScrollBar component as follows Called when...

Installing the Image Field module

In order to successfully install the ImageField module, we will also need to install the modules that the ImageField module is dependent on. Because of this, we will first need to install a total of three modules in order to use the ImageField module. These modules are as follows FileField ImageField Once we place these three modules in our site's modules folder, we can navigate to Administer Modules, where we should see the following Defines a file field type, mt . Depends Oft Content enabled...

The allowed domain and crossdomainxml

The allowed domain is the value that gets populated within the crossdomain.xml file of our Drupal site. The crossdomain.xml file is a file used by Flash to determine which sites it can communicate with and which sites it cannot. The Services module automatically generates this file using the Drupal menu system. We can see the contents of this simulated file by visiting our domain followed by crossdomain.xml, such as Although we do not have a crossdomain.xml file within our Drupal root on our...

Adding the Media Gateway initialization to mainas

Our next task will be to open up the main.as file, where we will include the initialization of the MediaGateway in our boot up sequence. Here, our goal will be to find the right spot to include this initialization, while at the same time, keep a synchronous boot up process. By synchronous, I mean that we should not start a new boot up process unless the previous process has finished. For the MediaGateway initialize routine, this will require us to take advantage of the callback function to let...

Using the Content Template module Contemplate

The Content Template module Contemplate for short is a wonderful module that will allow us to create a template for any content type in our system. A template is simply a way to tell the system how to display each content type when it is viewed by each visitor, and we can use this to tell Drupal to show our new Recipe Flash application when anyone views a Recipe node. To begin, we will first need to download and install this module by going to http www.drupal.org project contemplate. Once we...

Installing a media player

There are several media players available to show video and audio content on our web site. Although each one of these players has their differences, all of them are fundamentally the same in how they play media on the site they are loaded. Following are the most popular media players that can be used with the jQuery Media module to show videos Dash Media Player JW FLV Player jw-flv-player Flow Player http www.flowplayer.org All of these players are great, so I suggest you read up on all of them...

Flash with Drupal Views

Up until this point, we have only been dealing with single pieces of content within Drupal called nodes. Within each node, we have learned how to manage any form of data that Drupal can throw our way. Our next step is to learn how to handle lists of nodes within Flash using the extremely popular Views module. Using the Views module within Flash can be extremely powerful, since it gives us complete control over how we would like to filter our content within our Flash application and then deliver...

Adding some status text

Now that we have a login button, our last element that we will need for our login block is a status text box that will tell the user if an error occurred. This can be done pretty easily by creating a new layer in their timeline called status. Now that we have our own status layer, we will create a new dynamic text field within this layer, with an instance name of status. Enter your username and password to login. We should now have a set of Flash objects that resemble a user login block. To...

Adding the API key to our Drupal Service

Since the API key is only required for the services where data manipulation is required, we will need to structure our DrupalService class to either use the API key for some service calls, while at the same time, only use the session ID for others. Because of this, we will need to create our very own serviceCall method within our DrupalService that will handle these custom arguments depending on which service is called. Also, because the declaration of the call method, within the Netconnection...

The Drupal Service class

In all the previous chapters we interfaced with Drupal using the simple Netconnection call method. With each of these calls to our Drupal system, the API key was not required, and consequently, it was not necessary to build a separate class for interacting with our Drupal web site from a remote location. However, now, we have a special need to make certain service calls that require an added security measure, which should be encapsulated within its own class. Because of this, we will use this...

Installing the getID library

The getID3 library is a very useful PHP library that will automatically extract audio information called ID3 from any given audio track. We can install this useful utility by going to which is the getID3 library URL at SourceForge.net. Once we have done this, we should see the following We can download this library by clicking on the Download link on the first row, which is the main release. This will then take us to a new page, where we can download the ZIP package for the latest release. We...

Adding arguments to the service call

Our next task will be to determine which methods require an API key and which do not. This can be done using a simple function within our DrupalService class that will let us know if the API key is required given the service command. Although there are several functions that require an API key, we will only include the ones that we will use in our application. This function will look as follows Determines if we should use an API Key. private function usesKey command String Boolean switch...

Building a node editor in Flash

Before we can create our business logic for adding content to our Drupal installation, we will construct our node editor that we will use to view, edit, and add new content to our Drupal web site. Our goal here is to make this editor as easy to use as possible and make it obvious which operation we are performing viewing, adding, or editing . We can achieve this goal by creating an editor that resembles Drupal's node editor, where there are tabs at the top of the content that allow us to...