(Tutorial) Building a Web Service-driven Application with Flash in Drupal
Building a Web Service-driven Application with Flash in Drupal
Step 1: Creating our Flash application
With our chapter2 project open, we can shift our focus to the Actions panel
within the Flash IDE. Although working with the Actions panel is great for small
applications, we will eventually build onto this Flash application, which might
make it impractical to keep all of our ActionScript code within the Actions
panel. Because of this, we will first need to create a separate ActionScript
file that will serve as our main entry point for our Flash application. This
will allow us to easily expand our application and add to the functionality
without modifying the Actions panel for every addition we make.
Step 2: Creating a main.as ActionScript file
For this step, we will simply create an empty file next to our chapter2.fla file
called main.as. After you have created this new file, we will then need to
reference it within our Actions panel. To do this, we will use the include
keyword in ActionScript to include this file as the main entry point for our
application. So, shifting our focus back to the chapter2.fla file, we will then
place the following code within the Actions panel:
include "main.as";
stop();
Now that we are referencing the main.as file for any of the ActionScript
functionality, we will no longer need to worry about the Actions panel and add
any new functionality directly to the main.as file.
Now, for the following sections, we will use this main.as file to place all of
our ActionScript code that will connect and extract information from our Drupal
system, and then populate that information in a TextField that we will create
later. So, let's jump right in and write some code that connects us with our
Drupal system.
Step 3: Connecting to Drupal
For this step, we will first need to open up our empty main.as file so that we
can add custom functionality to our Flash application. With this file open in
our Flash IDE, our first task will be to connect with Drupal. Connecting to
Drupal will require us to make a remote call to our Drupal installation, and
then handle its response correctly. This will require the use of asynchronous
programming techniques along with some standard remoting classes built into the
ActionScript 3 library. I will spend some time here discussing the class used by
ActionScript 3 to achieve remote communication. This class is called
NetConnection.
Courtesy : Packtpub.com
- guru's blog
- Login to post comments
![Drupal-6-Book-[Building Powerful and Robust Websites with Drupal 6].jpg](http://www.drupalranch.com/images/Drupal-6-Book-[Building%20Powerful%20and%20Robust%20Websites%20with%20Drupal%206].jpg)