Interfacing Flash with Drupal

Please note that this article is rather dated. Although, the techniques mentioned in this article are still valid and are the "easiest way", it is not considered the right way to perform Drupal and Flash Interaction. The right way is to use the Services Module. I will be updating this tutorial very soon with the proper method for Flash to Drupal interaction, but in the meantime, keep in mind that this article will be changing soon.

Introduction

Like most people out there, I absolutely love Flash. More specifically, I love Flash websites...and you can always tell if a website uses it or not. Believe me...it makes a huge difference in the overall appeal of your website. However, what I have discovered the hard way is that trying to interface a Flash applet with your Drupal website is somewhat painful. And when I say interface, I am talking about the exchange of data... actually having your Flash applet extract information from your Drupal database. "Whaaaaaaa???" you say? Yes!... you can actually do this (I just had to do this in my latest version of FlashVideo)! And guess what? I will show you how...

Oh, on a side note, good luck trying to find this information anywhere else on the Internet. I tried but didn't succeed. So instead of just giving up, I actually brainstormed on a method of actually doing this. So, in this tutorial, I will explain to you the easiest way to happily marry Flash applets with a Drupal website. So, let us begin.



Understand how Flash extracts data

Flash receives outside data through the use of parameters passed to the Flash applet. There are two ways to pass parameters to your Flash applet. You can either use the $_GET method where you just specify parameters as you would in a URL like flashapplet.swf?param1=2¶m2=3, or by just using the parameter called FlashVars. FlashVars works very similar to that of the $_GET method and is actually the preferred method for sending data to your flash application. You do this by specifying a new parameter in the object code of your Flash object. It should look like the following.

Note that each parameter passed using FlashVars are separated by an "&". Flash will then parse each one of these parameters and actually create a variable within the ActionScript so that you can use it willingly. However, using this method, you must specify every single parameter separately and within the actual object code. Do you see the problem? What if you wanted to pass a whole lot of data to the Flash applet? Well, in response to this, Flash has also added the ability to extract parameter information from external files. You actually open the file and extract the file information within the ActionScript of the Flash applet (which is beyond the scope of this tutorial), but a person could easily specify WHICH file to open by using this FlashVars parameter like the following.

Now this file can be in the form of an XML file (if you wish to do XML parsing), a text file, or even better a URL... Hmmmmmm... Now were onto something. If I can specify a URL, then that would mean that I could also specify a PHP file, and then in the PHP file just echo any of the parameters to the Flash applet (XML format or whatever else)!! Now, that's cool!!!... unless your using Drupal.

The problems with Drupal

Drupal, if you haven't figured this out already, has a ninja death grip on all database extraction. What I basically mean by this, is the only way to truly extract any database information from Drupal is do so through the Menu / Path system of Drupal. This is just crappy for me, because this means that I can't specify a file that just gives me the raw data and nothing else!!! This is a great thing for web security, but painful if you wish to have a Flash applet extract information from your Drupal database. This is what took me forever to figure out how to bypass. I tried everything from creating a separate template file... actually creating a file and using external database modules...you name it. I just couldn't figure out how to get all the raw data without Drupal adding all that template HTML crap along with it. Well, after much learning and studying of the Drupal system, I finally figured out the easiest way to do this. I basically asked myself "When I go to any Drupal URL, where is it actually going?". And the answer was simple... index.php. All the magic of Drupal happens in this extremely small file. I know it is hard to believe, but it does. When you go to ANY url in the Drupal system, you are actually going to www.travistidwell.com/index.php and then anything else is just passed as an argument to this file. This is actually brilliant on Drupal's part. So, how do you extract information from your Drupal database with a PHP file... well, create your own version of the index.php file, thats how! For this tutorial, we will call it flash_interface.php.

Create your very own flash_interface.php file

The first thing that we need to do is create a new file called flash_interface.php and place that file in the root directory of Drupal (right next to the index.php file). The next thing that I am going to ask you to do is actually open up the index.php file. You can learn so much from these 40 lines of code. If you actually study the index.php file, you will notice two extremely important lines. The following code will be your template for creating an interface file.

These two little lines are all that it takes to basically "boot" Drupal. Think of it as a Windows operating system. The first thing that happens is your system boots up and loads windows. What does it do after that? Well, it starts loading applications. Well, in your flash_interface.php file, we want to boot Drupal, but don't want to start all the Menu / Path application stuff... so, we just won't include it. So in your flash_interface.php file, all you need to do is place those two lines at the very top of the file, and then you will have complete access to all the Drupal stuff!! One big thing is the database functions such as db_query will work as they normally would in a Drupal page or custom module. So, after those two lines you can put whatever you want, and echo whatever you want! What this means is that you can extract Drupal database information, and then just echo that information to your Flash applet! Here is an example...

flash_interface.php

Pass your flash_interface.php file to the Flash applet

So, how does this all tie in with your Flash applet? Well, remember the FlashVars parameter? All you need to do is just specify the following parameter in your Flash object code.

What you can then do in your ActionScript for you Flash application is just open this as you would a normal file. To Flash, this would be the same as if you just opened a text file with all this information in it. However, since it is a PHP file, you are completely at liberty to make it DYNAMIC data using the Drupal Database. Now that's cool!!!

Take it one step further

Ok, now lets suppose that we wish to make a Drupal page that has a Flash widget right smack in the middle. All this widget wishes to do is show you the node information of the current page... Using this method, you could actually do this! Here's how... First, you will need to create a new page. In that page you will need to place the object code for your Flash widget. It should look simlar to the following.

Don't forget to change the Input Format to PHP Code!

Do you see what I did? I basically am now passing a $_GET variable to my PHP file that has the current node ID. With this information, I can construct my flash_interface.php file to look like the following.

nid; $params .= '&title='.$node->title; echo $params; } ?>
flash_interface.php

What will happen now, is that the Flash widget in the middle of my node will now have information about that node!!! Now, how freakin cool is that!!!

Hope you enjoyed this tutorial...

I really like this

I really like this site.Thanks for sharing.
streamlight

Good post and a fantastic

Good post and a fantastic read. You have raised some valid points. Great work, keep it up. Pariuri sportive , Remi online , Biletul zilei , Case de pariuri , Pronosticuri , Meciuri live , Casa pariurilor , Pariloto , Table online . I love returning back to this site and reading the quality content you always have on offer.

this is very

this is very helpful.thanks
for more Highschool Letterman Jackets, visit High School Letterman Jacket

www.louboutindiscounting.com

Cheap Christian Louboutin Sandals
Cheap Christian Louboutin Sandals For Sale
Discount Christian Louboutin
Discount Christian Louboutin Shoes
Discount Christian Louboutin pump
Christian Louboutin Very Prive Leopard Pumps
Christian Louboutin New

Decoltissimo Pointed Pump - Pink
Christian Louboutin Lilian

Three – Strap Mary Jane Pumps
Christian Louboutin Very Prive

Fuchsia Pumps
Christian Louboutin

Very Prive Cream Patent Peep Toe Pump
Christian Louboutin Black

Python Peep-toe Pump
Christian Louboutin

"Jaws Python" Black & Ivory Leather Pumps
Christian Louboutin Very Prive

Suede Black Pump
Christian

Louboutin Lambskin Leather very prive Black Suede Pump
Christian

Louboutin Very Prive Suede Peep Toe Pump - Fawn-brown
Christian Louboutin Hyper Prive

Patent Pump
Christian Louboutin

Very Prive Peep- Silver Peep Toe Black
Christian Louboutin

Very Prive Peep-Toe Pumps Pink Suede
Christian

Louboutin Rolando Patent Hidden Platform Python Pump
Christian Louboutin Decollete

Grey Suede Pump
Christian

Louboutin Decollete Red Suede Pump 140309 210 AM
Christian

Louboutin Piagelle black glitter Pump 100309 307 AM
Christian Louboutin Rolando

Nappa leather pump
Christian

Louboutin Rolando Pink suede Pump 190309 1159 PM
Christian

Louboutin Very Prive Platform Pump pink suede 80309 341 AM
Christian

Louboutin Very Prive Patent Red Peep Toe Pump – Black
Christian

Louboutin Rolando Patent Hidden Platform black Pump
Christian

Louboutin Lambskin Leather ROLANDO Green Suede Pump
Christian Louboutin

Studded Mad Mary Patent Black Pump
Christian Louboutin

Very Prive Patent Peep Toe Pump - white
Christian

Louboutin Rolando Patent Hidden Platform Pink Pump
Christian Louboutin

lace-up python platform peep-toe pumps
Christian Louboutin grain patent

pumps
Christian Louboutin very prive

Black Python Pump
Christian

Louboutin Peep Toe Minibout Leather Pump-Acid blue
Christian Louboutin Pigalle

Anemone Bow Pump-Blue
Christian

Louboutin New Decoltissimo Pointed Pump Matte Black
Christian

Louboutin Very Prive Patent Peep Toe Pump – Wine-red
Christian Louboutin

Suede Leather very prive Grey Pumps
Christian

Louboutin Lambskin Leather ROLANDO Black Suede Pump
Christian Louboutin

Peniche 120 Patent Loafer Pumps-black
Christian Louboutin Black satin

anemone pumps
Christian Louboutin Pointed-Toe

black Pumps
Girly Sophistication

in Christian Louboutin New Decoltissimo Poi
Christian Louboutin

Peniche 120 Patent Loafer Pumps-pink
Christian Louboutin

Peniche 120 Patent Loafer Pumps-purple
Christian Louboutin

Mirrored Platform Pump in Fuchsia
Christian Louboutin Cut-Out Peep-

Toe Pump
Christian

Louboutin Decollete pumps - hermosa Pink Patent Leather
Christian

Louboutin Pointed-Toe Leopard patent leather Pumps
Christian Louboutin Very Prive Peep-Toe Pumps Navy Blue littered leather
Christin Louboutin Coxinelle T-Bar

Black Pumps
Christian Louboutin

Very Prive Beige Peep-Toe Satin Pumps
Christian Louboutin Dillian Pump - Red
Christian Louboutin Very

Prive Peep-Toe Leopard Pumps

What’s more, you are the

What’s more, you are the kind whom the IT companies favor because you know the importance to set a goal and unremittingly enhance your technique skills.Therefore, passing the xk0-002 test for Cisco exam helps you get more opportunities for promotion and higher salary.
SCJP certificationoffJNCIA certificationonCCDP certificationatCCDA certificationbehindCCIP certificationogg10g DBA certificationyes9i DBA certification

Drupal website is somewhat

Drupal website is somewhat painful. And when I say interface, I am talking about the exchange of data... actually having your Flash applet extract information from your Drupal database.
Indian Baby Names

well worth the read.I found

well worth the read.I found it very informative as I have been researching a lot lately on practical matters such as you talk about...
Scoruri Live
Biletul Zilei
Bonus Bet365
Bonus Gamebookers
Bonus Unibet
Bonus Partybets
Bonus Doxxbet
Bonus William Hill

links of london

If you want to have a florid links of london Horseshoe charm,Links of london online store, which provides links london Horseshoe charm which designs and styles are all from Jewelry, may be your choice.Wait for your order.now links of london sale lets suppose that we wish to make a Drupal links of london Earringslinks of londonsweetie bracelets page that has a Flash widget right smack in the middle links of london friendship All this widget wishes to do is show you the node information of the current page... Using this method, you could actually do this! Here's how... First, you will need to create a new page.links of london Silver Chain In that page you will need to place the object code for your Flash widget. It should look simlar to the following.

links of london

A links of london Lucky Catch Shell Charm is not only increasing your charm, but also bringing you good luck, it is said that shooting two birds is with one stone at llinks of london store.Lucky links london give luck to you.now lets suppose that we wish to make a Drupal page that has a Flash widget right smack in the middle.cheap links of london All this widget wishes to wholesale Links of London do is show you the node links of london 2010 NEW ARRIVALS information of the current page... Using this method, you could actually do this! Here's how... First, you will need to links of london wholesale
create a new page. In Links of London jewellery
links of london Friendship Bracelets
that page you will need to place the object code for your Flash widget. It should look simlar to the following.

Hey, it seems that you are

Hey, it seems that you are good at internet marketing and Drupal manufacture. You can join Freelancer.com to get more projects regarding both subject. Use this code BUILDIT4ME to get more advantages from the site. Good luck. Cleansing diet

What will happen now, is

What will happen now, is that the Flash widget in the middle of my node will now have information about that node!!! Now, how freakin cool is that!!!
Tower defense

I've been trying for ages

I've been trying for ages now to put some flash with Drupal, but I don't think I can do it. This post really help me out. Thanks buddy. I'll let you know my progress later. Thanks.

Tower defense

Once we dreamt that we were

Once we dreamt that we were strangers. We wake up to find that we were dear to each other.  lol! cheers!!

dog obedience training

Morality is not really the

Morality is not really the doctrine of how to make ourselves happy but of how we are to be worthy of happiness.

web templates

I will look into being more

I will look into being more selective with my commands to the bootstrap routine. I guess it really depends on your requirements.

cheap reseller hosting

Foot smell, loss of

Foot smell, loss of confidence, mainly cause people many psychological problems is one of the reasons. Produced as a mixture of private and public have been available to us through the bad foot odor Fx7 date is mixed. Single use is effective in 120 days. Moreover, the pores and sweat without cutting without clicking ..

tower defense games

Help

The tutorial is pretty good, but you need to be more specific about it please !!??

ECN Broker | Metatrader 4 Trading | Forex Trading Platforms

Do you see what I did? I

Do you see what I did? I basically am now passing a $_GET variable to my PHP file that has the current node ID. With this information, I can construct my flash_interface.php file to look like the following.
abercrombieandfitch
fitch clothing
abercrombie and fitch
abercrombieandfitch sale
abercrombie and fitch uk
abercrombie and fitch usa
links of london
sweetie bracelet
charm bracelets
charm bracelet
bracelet charms
silver charms
silver bracelets
links of london bracelets
links of london charms

HMM.

thanx alot this will hlp me out alot..:D

_______________

Brabantia Bins

i'm coming!!! tiffany

i'm coming!!!

tiffany jewelry
Choose, buy and shop for on sale tiffany jewelry including Tiffany & Co Silver Necklace, Pendants, Bangles, Bracelets, Earrings, Rings and Accessories.
tiffany co
Tiffany Jewellery offering bangle Jewellery, bracelet jewelry, eardrop jewelry, necklace jewelry, ring jewelry, finger ring jewelry and earring jewelry
tiffany
tiffany and co
links of london
links london
Tiffany Style Silver Jewelry: Rings, Earrings, Necklaces, Bracelets and more Tiffany Jewellery at low prices.

I've been trying for ages

I've been trying for ages now to put some flash with Drupal, but I don't think I can do it. This post really help me out. Thanks buddy. I'll let you know my progress later. Thanks.
office chairs

I will look into being more

I will look into being more selective with my commands to the bootstrap routine. I guess it really depends on your requirements. cheers!!!

korea fashion

Awesome stuff here thanks

Awesome stuff here thanks man i needed this!
e cigarette, e cigarettes

Really good tips!

Really good tips. It gave me all basic knowledge for using Flash with Drupal. I never thought it's so simple.
Sincerely, Tommy Fine Jewelry

uggs

ugg boots sale -The best Christmas Persents for Lover & Family
Christmas is coming,it's great time to shop Genuine UGG Boots as Christmas gifts to keep your lover & family warm and cozy.Love UGGs,Love UGG Boots UK
Ugg london sale is fashionable & warm and comfortable ugg boots London. Welcome to visit the uggoflondon.co.uk, you may will have unexpected surprises!
bailey button ugg boots
tall ugg boots,
cardy ugg boots,
UGG Sundance Boots.

Hey, thanks man, I never

Hey, thanks man, I never thought that Drupal can be combined with flash. Never try it either, though. But thanks, I'm going to try it now. It will be an advantage in my SEO campaign.
poker omaha

thank you for this awesome

thank you for this awesome post pal, cheers. . .

Carpet Cleaners Machine

btw, if you want to see more

btw, if you want to see more tutorial for Drupal, you can see their official website. They have a lot of tutorial and some videos too. Good luck.
madrid centro

Rado watch for sale

Tiffany Rings

Rado watches

it has got a great

it has got a great interface, any begginer can easily find a way . .

cheap holiday

i think there are some

i think there are some problems with the codes, not all of them seem to work properly. .

Oil Paintings

i think there are some

i think there are some problems with the codes, not all of them seem to work properly. .

Christian Louboutin Shoes

thanks all the time, These Christian louboutin shoes was one of fashion’s best-

kept secrets:means  Christian shoes has attracted a growing clientele for whom the fact that he is not a household name is all part of the appeal. “The minute we receive a delivery of his
Christian Louboutin , they sell out. Keeping up with the demand is becoming quite difficult.

http://www.trendyedhardy.com/

It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.

Ed Hardy Men Classic

shirt
ed hardy men Classic

shirt

Hey, it seems that you are

Hey, it seems that you are good at internet marketing and Drupal manufacture. You can join Freelancer.com to get more projects regarding both subject. Use this code BUILDIT4ME to get more advantages from the site. Good luck.

Christian Louboutin Shoes

Great post, thank you for sharing, look forward to read more of your post!Nobody can ignore the existence of Christian Louboutin shoes in the fashion world. And what makes
Christian Louboutin so remarkable?Its exquisite quality, fine craftsmanship, sexy high heels, quirky designs and of course the red outsole known as the symbol of
Christian Louboutin shoes.