Creating Drupal Sites with Flash or Flex

I’m pleased to see that an article I wrote for Adobe DevNet has just gone live. “Creating Drupal Sites for Flash or Flex” describes the benefits of using a CMS for your Flash or Flex sites, how to set everything up, getting Flash talking to Drupal, and a…

I’m pleased to see that an article I wrote for Adobe DevNet has just gone live. “Creating Drupal Sites for Flash or Flex” describes the benefits of using a CMS for your Flash or Flex sites, how to set everything up, getting Flash talking to Drupal, and also covers the various modules available to power your site.

Drupal is probably the most popular open source CMS out there, it has an enormous user community, and the best thing of all is probably the fact that you don’t have to write any PHP or SQL to take advantage of this as a result! (Unless of course you want to, Drupal is fully extensible).

There are many ways to use Drupal with the Flash platform, ranging from simple content access, to automatically generated content that is formatted for and consumed by both Flash and non-Flash enabled devices. Without going into any more detail, please feel free to head over to the DevNet article to read more and download the source code and examples.


It appears there have been some name changes in the Services module called by Flash (“views.getView” becomes “view.get” and “node.load” becomes “node.get”) – thanks to Stan for pointing this out in the comments. As a result I’ve modified the code and provided two versions below, the download I linked-to above has also been updated. The example FLAs are also now Flash CS3 compatible.

Update 2!

It seems the new Services module also has a breaking change when it comes to generating the sitemap, you’ll see no properties on your nodes except id. Do not download the official 6.x-0.14 release, instead get the 6.x-2.x-dev development snapshot as the bug has been patched (unless the official release is newer in which case the patch will already be in). For a deeper explanation, it appears the PHP was not loading the nodes you were requesting, so the only info it could return was the ID which wasn’t a whole lot of use for a sitemap!

56 thoughts on “Creating Drupal Sites with Flash or Flex”

  1. I’m going through this article and I’m getting an error on step five testing using the SitemapService class example. The error I’m getting is this: SitemapService.loadSitemapStatusHandler() status: undefined
    a fault occurred: NetConnection.STATUS

    When I check my AMFPHP gateway by going here:, everything seems to be fine. I’ve gone back over your steps to see if I missed something on the Drupal administrative side, but it looks like I’ve configured it as you outlined. Any thoughts on what I should try?

  2. Hi Rich! Hope you’re well and thanks for this tute – really powerful stuff!! Hope this thread doesn’t become a laundry list of errors, but for what it’s worth, I’m stuck on this using the flash ide: “TypeError: Error #1034: Type Coercion failed: cannot convert Object@20632e21 to” Have you seen that one by chance? Cheers!

  3. @Michael – For this one I’d need to see where that error occurs. Can you run the SWF in debug (in Flash or Flex Builder) and then it should switch to the line of code causing the problems. I’d be glad to help. To give a more general answer this error occurs whenever you try to cast or assign an object of one type to another that doesn’t fit in AS3 e.g. var myData:Data = someEvent; whereas you may have been needing var myData:Data =;

  4. From debug:

    Attemping to launch and connect to Player using URL C:wampwwwmkmultimediamkmultimedia.swf
    [SWF] C:wampwwwmkmultimediamkmultimedia.swf - 9171 bytes after decompression
    *** Security Sandbox Violation ***
    Connection to http://localhost/mkmultimedia/services/amfphp halted - not permitted from file:///C|/wamp/www/mkmultimedia/mkmultimedia.swf
    -- Untrusted local SWFs may not contact the Internet.
    SecurityError: Error #2028: Local-with-filesystem SWF file file:///C|/wamp/www/mkmultimedia/mkmultimedia.swf cannot access Internet URL http://localhost/mkmultimedia/services/amfphp.
    at mkmultimedia_fla::MainTimeline/frame1()[mkmultimedia_fla.MainTimeline::frame1:8]

    So, I seem to have some security issues I need to handle first. I get the error if i use “local” or “with networking” and have allowed the two domains to talk in my global settings. Also put crossdomain.xml files in a few places allowing everything “*”.

    Thanks very much!!

  5. @Stan – I’ve just tested and was running Charles. I can see the Drupal error is “Method views.getView does not exist.”

    This means you haven’t switched on the View Service module. Please let me know if you have enabled the “Views Service” from the Administer -> Site Building -> Modules page in Drupal in the section titled “Services”.

  6. @Michael – OK cool, so this is a security sandbox error. aka “cross-domain”. This should not occur if you are publishing from the Flash IDE, but it may occur if testing in the standalone player or a web browser (reasons below…).

    If you want to run a local (hard drive) SWF that communicates with a server you have to “trust” it. Right-click any running SWF, choose Settings -> Advanced. On the Adobe Flash Player Settings page. Go to the Global Security Settings Panel, and add the file (or a parent folder if it’s going to cover more projects/files). This way Flash Player allows a local-only SWF to access a network (localhost in this case).

    Alternatively, don’t run the SWF in standalone player, instead deploy it to your webserver, or localhost in this case. So that the SWF exists on the same server (at http://localhost/files/my.swf for example) along with the services it is trying to access.

    I would opt for the latter approach, although in the past I have trusted things like a “projects” directory in some cases where I didn’t have a local server.

  7. Thanks for the reply Rich. I have switched on the View Service module, but after upgrading to the most recent version of Drupal (6.12), the name of the service is now “views.get”. I’ve changed the string in the netConnection call on line 37 of accordingly, but I’m still getting the same error.

    @Michael Kaufman I was getting that same error until I realized the NodeService class was trying to call the “node.load” service. The problem is as I mentioned in the previous paragraph, if you have the most recent version of Drupal installed the name has changed to “node.get”. Change the string on line 49 or and see if it works.“node.get”, responder, nid, fields);

  8. If I run the SitemapServices example and run Charles, I get:
    faultDetail: …/sites/all/modules/amfphp/amfphp.module on line 106
    faultString: Access denied.

    I’m able to run the test from Administer › Site building › Services › views.get. Any thoughts?

    Thanks for your help! Your article is the first real comprehensive look at using a CMS like Drupal with a Flash/Flex front-end.

  9. Thanks Stan, it actually appears to be a change in the Services module, as of version 6.x-0.11 or later the two calls are named differently. I’ve updated the code and this blog post. I’d be very grateful if you could test with the new zip, and many thanks for pointing this out. That’s the problem with open source, it can be confusing 🙂

    As for your error, if you check the Administer -> Permissions screen. Have you allowed node access (and all the other checkboxes mentioned in the article)? Also, have you unchecked the security checkboxes in the Administer -> Services -> Settings page?

  10. Rich, I have enabled the Permissions and unchecked the boxes in the Settings section as well. The NodeService example works, but I’m still getting the same error with the SitemapService example, using the class files from your updated ZIP file.

    I’m going to check out line 106 of “../sites/all/modules/amfphp/amfphp.module” to see if I can see what might be causing it to deny access.

  11. Is anyone else getting errors with the SitemapService example? I wonder if it’s a localhost vs. live server issue? I don’t see how it would be different.

    Have you been able to access the Drupal AMFPHP Browser? That would help a lot for debugging. I don’t have a problem accessing it when it’s separate from Drupal.

  12. @Stan/Richard I really wish I checked back here an hour ago….before I started back on this one 😉 Changing line 49 and adding a security policy the right way just fixed it for me – thanks very much!!

    btw Stan, I was also getting errors for a path to globals.php that did not exist. So I created a “sites/all/modules/amfphp/amfphp” folder and put the Browser, Core, Servies files etc.. in there instead of “sites/all/modules/amfphp/”. Maybe that will help.

    Thanks again Richard – this is really brilliant stuff. Now, off to play with the data in Flash!

  13. Hi Stan,

    I have been testing with a live server. If you like, please feel free to create a user (and give it admin access, or near enough) on your installation and I’ll go ahead and double check all the settings and try connecting from here. You shouldn’t need to modify any PHP to get all of this working. You can email me on the Contact page of this blog. I don’t think the Drupal AMFPHP browser works without some modifications (but I haven’t used it to be fair).

    Now that you’re node service call works, we must be almost there. Finally, just to check, the error was views.getViews does not exist, but that was fixed with the new zip, and now the error is a permissions one?

  14. @Stan, please see the second update. Apologies I must have used the version just before they made these breaking changes. I hope that resolves the problem. I should also point out the default number of nodes to return is 10, so people may want to set the Items to Display to 0 (unlimited) for the sitemap View.

  15. Hey Richard, updating the Services module to 6.x-2.x-dev development snapshot fixed it. I would like to mention that once you update you need to enable the new Services – authentication Key Authentication module in order to return any results.

  16. Hi Richard,

    I have missed this post earlier.

    In the past few months I’m working with Drupal a lot and have created a solid codebase that covers every aspect of the CMS.

    I’m planning to release the core part an an open source project but I don’t have enough time and I’m looking for people interested in the topic who are willing to join the project.

    Get in contact if you’re interested in learning more.

  17. Hello, I seem to get this error when running updated modules and versions of either sample fla…node or sitemap…and no returned data:

    AbstractRemotingService.netConnectionNetStatusHandler() – error:NetConnection.Call.BadVersion

    Anyone know what I might be doing wrong?
    Thank you for any feedback.

  18. Hi Mike, this is usually a PHP error, there’s a few tips in the article under “solving common problems” regarding turning on and viewing your error log to see what happened.

  19. Hello Richard,
    first let me say “Thank you” for the great Tutorial. I have been waiting for years, for a Tutorial like yours!!

    I have some troubles that i can´t solve. Please would you be so helpful to help me?

    I have follow your instructions 1:1, but when i come to this part (The first step is to visit the Administer > Site Building > Services page and uncheck the Use Key and Use Session ID options. This allows you to access the services from the comfort of Flash without putting the SWF file on the server.) i can´t find an Use Key and Use Sessions ID options.

    I don´t know what to do? I have try everything.

    Thank´s for helping!!


  20. Hello Richard,
    thank you for the really fast answer!!
    Now i have found it. Please can you help me once more? I also try to set the 3 permissions (Access services (found under “services module”); Load raw node data (found under “node service”); Access all views (found under “views service”) but i can only set it under “comment module”. the other 2 permission settings i have not … I don´t know why. I have everything installed like you described. Here is the link to a screenshot.

    Thank´s again!


  21. Hi Mario,

    Drupal changes from time to time, so new options may appear, some may go away. If you’re unable to follow the article exactly don’t worry. The idea of the Permissions screen is to enable access to functionality of the modules. Skip over the step where you need to and give it a try to see what errors you get.

  22. Hi Richard,

    thanks again!! I have skip over this step, but if i test your swf (node_test.swf) i get an error (AbstractRemotingService.netConnectionNetStatusHandler() – error:NetConnection.Call.Failed). I think this error belongs to the missing setting. I have installed AMFPHP to When i test amfphp in the Drupal Backend, it seems to work. I haven´t any idea what to do else …

    Thank you!!


  23. OK, the path i used in your Flash File was´nt correct. Sorry!! Now i have set the path to: and now i get the following back: resultid:1

    Now it should work …

    Thank´s for beeing so helpful!!


  24. Hi Rich!

    This article seems to be very useful and the idea of interacting with flex and drupal is exciting as well. I just tried to follow your article in devnet and had some trouble that I just can’t fix.

    The problem is some errors appear when I try to compile from flex, copying exactly the code you provided into a “mx:script” tag:

    1046: type was not found or was not a compile-time:ServiceResultEvent
    1046: type was not found or was not a compile-time:ServiceFaultEvent

    It appears in both handler functions for the result and fault events. I set the folder uk with your classes as a source folder in the Flex Build Path, so the classes should be found propperly.

    Drupal is propperly installed and the services-config.xml and the amfphp are working fine, since the example you provided “node_test.fla” works from Flash CS4. I also set the services arguments in the Flex Compiler and there’s no error with that.

    Am I missing something in my MXML file or in my Flex Projects settings?

    Thanks in advance, I hope you can help me

  25. Richard,

    Thanks for the great article! This was exactly what i was looking for…

    One problem has come up, which I haven’t been able to find the solution:

    I’ve upgraded to the services module 6.x-2.x-dev and i’ve got one big problem.

    the ServiceResultEvent only reads half of the intended values. I’ve created some of my own fields and my result comes back (null). I’ve tried to see if on the drupal side, but i think some where between my views.get call and my ResultEvent.RESULT ObjectUtils.ToString(), the information is being dropped. Every created field I’ve made are dropped and the general field show up.

    Any help or advise you could throw my way. Thanks


  26. Good Morning Richard,

    i have stil 2 problems, that i can´t fix. Please would you be so helpful again?

    If i try to edit the view.get under Services (sitemap / nid,type,path,title,parent) i can´t save the new settings – i always get an error “Access denied”.

    The second problem is that i get an error if i try your sitemap_test.swf. … the same error as Stan (SitemapService.loadSitemapStatusHandler() status: undefined
    a fault occurred: NetConnection.STATUS
    ). But i have installed the 6.x-2.x-dev of Services.

    I don´t know what to try else …

    Thank´s a lot!!


  27. Hello Richard,
    very interesting article, thanks!
    I’ve got one problem :
    when Ioad a node by the node.get method, my node is avaible in flash, without any problem.
    But when I load a view named siteMap, the body of the nodes are null, like all object fields, except for the nid, wich is working correctly.
    In the Live preview (in drupal administration), everything is going right, but when I check the amf result with Charles, as you suggested for other people leaving comments on this site, I see only correct nid and every field are null.
    So I just get the nid of the nodes with views.get, and after I get the nodes data by calling node.get for each one.
    Did you succeed loading the siteMap view with complete nodes ?

  28. Thanks for this great tutorial! As I am Working through – two things that I thought I would add:

    1. After enabling the Key Authentication module, I found the check boxes for the Services (using 6.x-2.x-dev) (first part of page 5) in “Administer > Site Building > Services > Settings”, as mentioned above. They are visible after selecting the “Key authentication” in the Authorization module.

    2. I had a problem with amfphp because I did not have “Clean URLs” enabled. Without it enabled, in the first example, I had “” and I got NetConnection.Call.Failed errors. I switched it to
    “” and it worked. Now I need to get “Clean URLs” switched on…


  29. Hi Richard,

    By some stroke of outrageous fortune, the original version worked for me. Unfortunately, it doesn’t really go as far as I would like. When’s the next installment–the one where we build a complete solution?



  30. Very sorry I’ve been snowed under and unable to look at these issues…

    @Victor – I set up a sample project in Flex, here’s the download –

    @Kris – What does Charles ( show in the result object? This way we know if it’s the server or the client code that needs changing.

    @Mario Boro – Your first problem sounds like you’re not logged in to Drupal as an admin user, please check that, and also the Permissions page to see that admin users have rights to modify/edit views. It sounds like another Permissions page thing, anonymous access to “Access Services”, “Load raw node data” and “Access all views”. Also do any of the other comments in this thread help as we’ve had a few types of problems and fixes.

    @xavier – Hi, yes I did, did you see Update 2 in the blog post? Any luck with that?

    @Chipp – Thanks very much for providing this extra info. I should have stated in the article that without clean-url’s enabled, the addresses change. If you’re having issues perhaps the .htaccess (invisible) file was not copied to the root folder of your Drupal installation.

    @Tom – I’m so glad it worked for you first try, hopefully that means the article now contains all the required details and means you can do this without any problems! Either way, missing just one can lead to some of these problems so it’s by no means an easy setup just yet, as with most open source! There’s a book mentioned on regarding Flash and Drupal, perhaps that’s your next move? Also Asual (SWFAddress) has presented on Hyperflex and this technique is interesting so maybe search on that. Other than that I recommend just learning more about drupal, with the Services module you can access anything you can build in Drupal so it’s pretty unlimited, Flexi-Fields, Views, and so on.

    For all those having problems. The thing about this setup is it will always require some exploration and tweaking, it’s a very advanced setup with lots of moving parts. But for me it caters for so many more situations than simple loading of XML files can, that the benefits far outweigh the challenges involved with figuring out how this would all work in the first place. There are simpler CMS’s aimed at Flash, but then you wouldn’t get the extra extensibility that comes with Drupal, so it’s up to you, and I wish you the best luck in getting it running exactly as you want it.

  31. With a little tweaking and twisting and googling, I was able to get this set up as well… and my experience in Flash CS4 started as soon as I picked up this article. This is likely going to be a fairly standard setup soon, one that I personally expect to see more widespread on the internet once links proliferate further.


    Thank you very much for your replies to the questions here on this page; a couple of them lead me to completing my goal. I know that it’s impossible to help everyone, but I would like to ask you if you could point me in the right direction to flesh out this application further. If you know of any resources that might aid me in figuring out a good way of actually using the information that is appearing in my output panel, and the raw information that I’m able to display in a textbox on my stage, then I’d be very grateful.

    As it stands, I’m just studying a couple books I borrowed about ActionScript 3.0, but I’m just worried that because your technique is so fresh and new, extrapolating a method from these paper pages might take a lot longer than I’d really hope.

    Then again, this is a great incentive for me to cram as much AS 3.0 into my brain as I can in one week 🙂

    Cheers to all!

  32. @Matt – Thank you. Yes I think a follow up post at some point will be worth while. You mention getting raw text displaying. The thing is, this is a very non-prescriptive approach, merely aimed at getting data out of Drupal. Within Drupal you can set up Content Types (e.g. an AboutUsPage type), that would contain more than just a title and body field, it could contain custom fields using the CCK module, and those can be class/object-like complex fields using the Flexi-Field module. Within Flash you can take these values, objects and arrays of values/objects and present the data any way you like. You can store anything from text, to image paths, to form designs within Drupal and consume it in your Flash. So that’s the next step, get some custom content types set up, add some custom fields, simple, complex, single or multiple, and get that data into Flash.

    If you are using Flex you’d be able to present this using ActionScript and MXML, if in Flash you may use on stage elements, or entirely constructed visuals in ActionScript. From image galleries, to forms (and service locations/actions to submit the form), to news feeds, everything can be constructed and presented using this technique.

  33. i get this error, have you seen it before? i do not know at which line it is thrown, i do not get this information (although running it in debug mode)

    TypeError: Error #1034: Type Coercion failed: cannot convert Object@20632e21 to

    i have it with in flex builder and also i tried the provided node_test.fla

    any ideas?

  34. solved the problem i have described above: at Administer › Site building › Services › Settings i had to choose a authentification method first, then i could un tick “use key” and “use session id”. seems like this is needed!

    btw: thanks for making this great article 🙂

  35. Hi Richard,
    Following tutorial is very nice for implementation. Thanks for nice efforts.
    I am implementing this tutorial but on step of sitemap i got following error

    AbstractRemotingService.netConnectionNetStatusHandler() – error:NetConnection.Call.BadVersion

    Please can you tell me that what is problem with this. i am waiting for your reply.


  36. another thing i see in previous post a person have same problem i follow that solutions which mention against that post. but i didn’t receive any error in error log.


  37. @Richard @Kris line 49“node.get”, responder, nid, fields);
    The ‘fields’ parameter to the server side never contain the custom fields we added in the content type. So it will not fetch those fields from the database.
    I tested with a mx:RemoteObject id=”ro” destination=”amfphp” source=”node” and actionscript code ro.get(“1”); in flex and it returned all the fields.

  38. I’m finding this tutorial exactly what I want… I’ve done everything pretty much right and I’m pulling in my siemap, great!

    Ahving said that I can only see some of my sitemap and some of my fields appear as ‘null’. Does anyone know what I’ve done wrong? Or explain wether this is normal? I’d really like to pull in the custom content i’ve put into the cck fields. If anyone knows I’d really appreciate any help, or example if I need to further the actionscript.

    Cheers, Mike.

    here’s an example of my sitemap results…

    title:Hi-Res Image testing title

  39. Hi Mike,

    Yes it appears there’s an error in the code I uploaded so I’ll look at fixing this asap, thanks for Jerry for pointing it out. I must have missed something when creating this version from my own code lib.

  40. @Richard,

    Thanks again. I was able to poke around a bit more and successfully pick and choose which fields I wanted to display on my stage. Excellent!

    Now I just await the sitemap fix.

    Sorry for being the newb 😛

  41. Richard, thank you for the excellent article. Considering how cool this is and in the hopes that you continue with pioneering this integration, I will be a regular visitor.

    Can you please provide a dl link to swfaddress 2.1? I cant seem to find a working link. There is a support request on the project page to update for 2.3 but the project looks inactive.

  42. I get a message something like “error unsupported version”. If there is a way to shoe horn the newer version that’d be great, but i’ll settle for 2.1 for now so I can test it out.

  43. Thanks for the tut, Richard. One question:

    sitemap.getNodeWithPath(“/about”) gives the error 1120: Access of undefined property sitemap.

    Any clues where I’m going wrong here?

  44. Hi Richard,
    I tried following your tutorial, but I was getting weird errors. I downloaded your example project, and the errors seem to have gone away, but when I run the code, I get a blank screen. I was having the same problem with the SWFAddress2.3 versus SWFAddress2.1, the drupal site has a link to the right download, though when I download it, my site won’t acknowledge that it is there and I get an error in drupal. Could that be the reason for the blank screen? I am trying to get Drupal to work with ARCgis and this is the only way I can figure it out. This is very important to the people I work for so any help would be great.


    2.1 link:

  45. Great tutorial, but it appears the is only 54k and more-or-less empty. Bad update? Looking forward to checking this out – thanks!

  46. Hey there,
    thanks a lot for your work, it’s very cool! I am new with as3 and flash, how can I display the informations I see with the trace? If someone has links or exemples… Thanks a lot for your help…

  47. Hi Vincent,

    If you want to see the trace() messages, you have to use either the Flash authorization IDE (aka Flash CS3/4 IDE), or Flex builder. (In Flex builder trace only enabled in debug mode.) Although it’s a bit tricky to emulate the real Drupal-Flash worflow in an IDE. It’s possible to get remote trace messages with MonsterDebugger:

Comments are closed.