Internal: Combining Drupal, AMFPHP, SWFAddress and Flash

December 19, 2007 – 6:20 pm Tags: , , , , , , , , ,

I have recently been working on creating flash websites that are running off of a Drupal CMS. This approach to bringing content into flash is pretty slick for a couple of reasons:

  • it provides the maintainer of a website a user friendly way to put content into their website
  • with amfph, and remoting in general, it makes it much easier for the flash developer to exchange data in and out of flash
  • creates an HTML version of the website so that anyone who either doesn’t have the flash player, or (gasp!) doesn’t like flash can still view the page in HTML
  • and it’s just kind of cool that these two systems can work together so smoothly!

So, together with detour, we created a nice demonstration of this technique.
Oh, and I had to sprinkle in a little Papervision3D 2.0 in there, just cause, I don’t know, how can you not?

Click on any of the images to check it out-

To get the Drupal side of things all up and running, you’ll need to do a few things:

  • Download and install the latest revision of Drupal
  • Download and install the Services, amfPHP, and Views modules for drupal
  • Download and install amfPHP. Make sure to place the amfPHP folder within the amfPHP module directory.
  • Get the flash site module from thirdavedesign (the flash site module makes sure going in between the two versions happens smoothly)
  • After getting everything installed correctly, go into Drupal/Admin/Site Configuration and create an API Key. You don’t have to give the service a name or anything else. After creating the key, save it for later, as you’ll need it in Flash.

Below is the how the internal is viewed in HTML:

Now that you’ve got Drupal, amfPHP and, all the modules installed, its time to take it into Flash. First, you’ll need a way to connect to the amfPHP remoting service. Thanks to cohort Joe Turgeon, we’ve got a simple actionscript 3 class to do it, not surprisingly called Drupal.as. You can download it from here:

So once you’ve got that file in the proper directory, it’s time to set up you main document class, which should include something like this:

import Drupal;
private var dru:Drupal;

public function main()

{

     setUpDrupal()
}

private function setUpDrupal()

{

dru = new drupal();
dru.gatewayUrl = gatewayUrl; //this is the url of your amfphp service responder
dru.apiKey = apiKey; // this is the api key from inside drupal

dru.connect(onConnection);
}

private function onConnection()

{

dru.service(getArticles, onFault, “views.getView”, “pages”);

} private function onFault(e:Error)

{

trace(”there has been an error “+e);

}

private function getArticles(result:Object)

{

      for(var prop in result)
      {
           trace(”title is “+prop.title);
           trace(”body is “+prop.body);
       }
}



So this is obviously a pretty basic set up of drupal / flash, but hopefully its enough to get someone started. You can read more about it at arithmetric.com. There is also a basic example site complete with example site sources.

Thanks a lot to Joe on this project, because I had been dragging my feet on the drupal/remoting/flash stuff for awhile. After waiting so long for me, he decided to learn actionscript 3 so he could do it himself- Quite a feat for only 3 weeks of research, I would say. It’s nice to have him on the evil Flash side now!

There’s definitely more room for research here. Incorporating SWFAddress makes it pretty cool in terms of SEO and whatnot, but we’d really like to be able to print all the content into the HTML for each page.

Some other things we’re interested in doing are working with different Views, so that we can bring other types of content into a flash document.

Either way, I’m sure I’ll let you know about it when its done!

  1. 68 Responses to “Internal: Combining Drupal, AMFPHP, SWFAddress and Flash”

  2. Wow, this is just what i was looking for.
    Thanks for this great tutorial.

    By Niel on Dec 20, 2007

  3. This looks absolutely great, thanks a lot! I’m about to redesign my band’s website and for the last few years I have been editing a txt file (from my mobile for instance) whenever I have wanted to make any changes but perhaps drupal is the way to go.

    But is your way of doing it limitated to text and images only? It would be perfect if I was able to use some of the other drupal modules also.

    By Alex on Jan 11, 2008

  4. Hey Alex,

    The remoting services can be extended to get almost any information out of drupal.

    What you’ve got to do is create a custom view in Drupal for whatever information you want to bring into flash.

    For example, perhaps you set up a view for Events which returns event time, event title, event location.. etc.

    Then inside of flash, you’d set up a new service, like:

    dru.service(handleEvents, onFault, “views.getView”, “events”)

    Let me know if this helps. If you need any help on setting up different kinds of views, there’s some good resources here

    By Thomas on Jan 14, 2008

  5. I keep getting Error opening URL http://localhost/drupal/services/amfphp/gateway.php

    But when i go to http://localhost/drupal/services/amfphp/gateway.php

    i get amfphp and this gateway are installed correctly. You may now connect to this gateway from Flash.

    By Jake on Feb 1, 2008

  6. Hi Jake,

    Drupal doesn’t work with the native amfPHP service browser. I’m not sure why it’s not supported-

    To browse your services through drupal, go to admin>site building > services. At that page, you can test your services by clicking on any of the services listed.

    By Thomas on Feb 1, 2008

  7. Thomas,
    I did do a test via the services (views.getView) and the view name parameter and it worked displays the info when i test.. but in flash i get
    Error opening URL http://localhost/drupal/services/amfphp
    Error #2044: Unhandled NetStatusEvent:.level=error, code=NetConnection.Call.Failed

    By Jake on Feb 1, 2008

  8. Ah, I know that error-
    You need to give access to the services module in your drupal installation.

    In the user access section, browse to services, and check the boxes to enable anonymous, authenticated, and admin access.

    I should have mentioned this in the original post, thanks for pointing this out!

    By Thomas on Feb 1, 2008

  9. I am almost there, arr..
    error: drupal services
    101
    View does not exist.
    Unknown error type
    C:\xampp\htdocs\drupal\modules\amfphp\amfphp.module
    AMFPHP_RUNTIME_ERROR

    any idea.. i tried googling that, no luck yet. but the view exists cause when i browse via drupal services i can type in the view name and it shows up all the nodes

    By Jake on Feb 5, 2008

  10. Now i think its about to work. then i get this stupid error
    TypeError: Error #1034: Type Coercion failed: cannot convert Object@44549a1 to Error.

    I am determined to get this to work

    By Jake on Feb 7, 2008

  11. you’re getting close!

    I’m thinking, however that this error is raised in the error handling function.

    Try this:

    private function onFault(error:Object):void
    {
    for(var prop in error)
    {
    trace(”error info”+prop);
    }
    };

    Also, are you using the debugger to find out where in your code the errors are happening?

    By Thomas on Feb 7, 2008

  12. Wehre can i find the “flash site module from thirdavedesign”? Is this the SWFObject API from Drupal? Can you give me a link. Thanks ;-)

    By Maaak on Feb 8, 2008

  13. Hi Maaak,

    The flash site module from thirdavedesign is currently in research and development. Because it is not mine, I wouldn’t feel comfortable giving it out.

    But send me an email, and I can get you in contact with the responsible parties. Perhaps if you bug them enough it will be completed sooner :)

    For now, you can play around with the new search service!

    By Thomas on Feb 10, 2008

  14. Hi Thomas,
    Do you have the possibility to post the fla source of your example?

    By Claudio on Feb 18, 2008

  15. How do you deal with security if you have to open up Node.Save as a service.

    Let’s say you wanted to have a Flash based guestbook on your site which used the Node.Save service. Anyone can crack your Flash file and get the remoting info and then hook into your services from external domains and write to any node on the site.

    Have you found a way of blocking this?

    By Evan on Feb 18, 2008

  16. Hi Evan.

    Joe of arithmetric has been worried about this for some time, and has been working for a fix to this issue.

    He commented about it here.

    This is a serious issue, and I might advise against using this technique (drupal/amfphp/flash || flex) in a production environment until this issue is solved.

    I still think that drupal/amfphp && flash || flex == good. We might need to refine some things, but this approach towards CMS and flash development is really exciting!

    If you think you could offer some help in improving the Drupal Services module, please get in contact with joe.

    By Thomas on Feb 19, 2008

  17. Hi guys,

    I would like to come back on a post from Jake:

    error: drupal services
    101
    View does not exist.
    Unknown error type
    C:\xampp\htdocs\drupal\modules\amfphp\amfphp.module
    AMFPHP_RUNTIME_ERROR

    I am getting the exact same error, but could not find what did Jake to get ride of it, if anybody, or Jake can give me a hand on this one, it would be great!

    Thank you guys

    By krem on Feb 26, 2008

  18. Hi Krem,

    Usually when I see this error, it is because I haven’t set the permissions of a view properly. Another problem I sometimes have is that I’ve named the view something different than the view I’m using in flash.

    Make sure to create a view, say, named ‘pages’ which returns all pages. Set the permissions on the view to be accessible by all. Set the permissions on the services module to be accessible to all. Then, in flash, use:

    dru.service(getArticles,onFault,“views.getView”, “pages”);

    By Thomas on Feb 26, 2008

  19. I’ve been working with a few different installations and for people, and have found one thing that people often haven’t done.

    I should have mentioned this in the tutorial, but you must make sure that clean urls are enabled in drupal.

    Getting this to work can be somewhat of a task. You can read about doing it here.

    If you set this up properly and Still have problems, let me know-

    By Thomas on Mar 5, 2008

  20. I’m having problems with latin characters like ã ç á à.
    Flash display accented characters the wrong way

    By francisco on Mar 6, 2008

  21. Has anyone written step by step instructions?

    By suoko on Mar 13, 2008

  22. Hi Guys,

    After days and days of frustration I finally know what was wrong with my setup!!

    If you have a problem like:
    101
    * does not exist.
    Unknown error type

    Try to replace in your main document class:
    dru.connect(onConnection);
    by
    dru.connect(onConnection());

    I think it was a typo mistake in the displayed source code, if people could have a look into it and tell if the fix works for them it would be great, and in result the displayed code could be updated.

    So happy guys, I can finally begin the real work! Will post here any published content with flash and drupal!

    Bye

    By krem on Mar 21, 2008

  23. Hello Thomas,
    This looks really, really interesting. I wondered if an FLA was available? Many thanks for your time.
    Contact: ubahnclothing@yahoo.co.uk

    By Beechy on Apr 6, 2008

  24. Hey Beechy, I’m glad you enjoy it-

    You can use any .fla file. It can even be completely empty. But you need to specify in that .fla a document class that uses the Drupal.as file.

    You can get this file: http://arithmetric.com/projects/drupal/main.txt

    and use that as your main document class. Let me know if this is confusing… hope it helps

    By Thomas on Apr 7, 2008

  25. Hi,

    this class is really awesome and I am using is like crazy.

    I have one issue though…

    e.g. i have a view that displays the content for a particular user - in the drupal view i have the argument specified for the username

    What I can’t figure out is how to pass the argument in the service call in flex

    dru.service(makeArticleList, onFault, “views.getView”,[should this be an array?]);

    I have tried various permutations however I keep getting

    Type Coercion failed: cannot convert Object@541f471 to Error.

    any ideas?

    By Dinesh on Apr 9, 2008

  26. Hey Dinesh-

    I’m glad you like flash and drupal!

    I’m not exactly sure where your error is coming from, but I can tell you one thing-

    Try changing this line:

    } private function onFault(e:Error)

    to this:

    private function onFault(e)

    and see what you come up with.

    An error (I’m not sure exactly what..) is being dispatched as an object, and in the onFault function signature flash is trying to coerce that object into an Error object, which won’t fly.

    Change that, check out what information the non-error object contains, and go from there!

    hope this helps-

    By Thomas on Apr 9, 2008

  27. Excellent, thanks that helped a great deal, I also figured out that the if you want to pass an arg to a view it needs to be an array - even if its 1 argument.

    By Dinesh on Apr 11, 2008

  28. actually scratch my last comment. it does not need to be an array if it is only 1 string argument.

    author:String = “dinesh”;
    dru.service(makeArticleList, onFault, “views.getView”,”articles”,null,author);

    will work

    By Dinesh on Apr 11, 2008

  29. What a great tutorial! Thank you so much! I was bussy puzzeling around with this but I can’t get this to work:

    import Drupal;

    // Drupal settings

    var drupal:Drupal;
    var gatewayUrl:String = “http://localhost/drupal-flash/?q=services/amfphp”;
    var apiKey:String = “3c13b71f0022a80d65158f5ae768e023″;

    drupal = new Drupal();
    drupal.gatewayUrl = gatewayUrl;
    drupal.apiKey = apiKey;
    drupal.connect(cbConnect);

    var knoppen:MovieClip = new menu();
    var mcArray:Array = new Array();

    function cbConnect():void {
    // send request
    drupal.service(cbArticles, onFault, “views.getView”, “nieuws”);
    }
    function cbArticles(result:Object):void {
    for (var i = 0; i < result.length; i++) {
    trace(result[i].title);
    knoppen.knoptxt.text = result[i].title;
    knoppen.name = “knop” + i;
    knoppen.y = i*knoppen.height;
    trace(i);
    container.addChild(knoppen);
    mcArray.push(knoppen);
    //menu.addItem(result[i].nid, result[i].title, result[i].body);
    }
    }
    function onFault(error:Object):void {
    trace(’error: drupal services’);
    for each (var item in error) {
    trace(item);
    }
    }

    I used it on the stage, with a MC called menu in the library. But when I use this only the last item shows up. I would like to addChild for every item (object) instead of just one.

    Could anyone help me please?

    Thank you!

    By peter on Apr 13, 2008

  30. Dinesh was talking about problems when passing arguments. I wondered if anyone could offer any help? I have a view which shows a paticular user’s content. When I look in the services browser, the view returns the right values for the arguments passed. When I call this same one in the flash it doesn’t work. What common mistakes are made when dealing with passing arguments to a view.getView call in AS3?

    drupal.service(userArticles, onFault, “views.getView”,”user_favourites”, null, 1);

    I get this error:
    error: drupal services
    Invalid argument supplied for foreach()
    Unknown error type
    /Applications/MAMP/htdocs/fixdit-Alpha-1/sites/all/modules/views/views.module
    715
    AMFPHP_RUNTIME_ERROR
    Thanks.

    By BeechyBoy on May 13, 2008

  31. Perhaps a stupid question; but does your folder with flash files and .as files need to be inside the Drupal directory.
    It doesn’t work with a folder on my desktop,
    (testing inside Flash CS3) or am I missing something.

    By Dries on May 20, 2008

  32. The sample Main.as file (from arithmetric) contains several imports,
    to, I guess, interface elements. Because this is not provided I can’t see any output. A little info on how to output the drupal data in flash would be greatly appreciated. (text element? Movieclip?)

    By Dries on May 20, 2008

  33. thanks for this… I have gotten this working, but I do have one question:

    I get an error stating “User Error Method system.connect does not exist. 101 AMFPHP_RUNTIME_ERROR”. My view data still gets passed in, but I can’t figure out why I am getting the fault.

    any idea what may be causing this?

    By lucidmedia on May 27, 2008

  34. Hello,
    great work, i must say, even if i can’t seem to make it through this error :
    error: drupal services
    /Applications/MAMP/htdocs/CMS/drupal-5.7/modules/amfphp/amfphp.module
    Unknown error type
    View does not exist.
    101
    AMFPHP_RUNTIME_ERROR

    i have tried everything that was mentionned here, and opened every single permissions for users….. it works perfectly fine in Drupal’s Services calls, but not in flash !!!! Could it have something to do with the way the View is set up ? Does it have to be set up in a very specific way ? If you have solved this issue please help !!!
    thanks

    By Vincent on Jun 30, 2008

  35. I’m pretty new to all this and cant get past the first stage. I assume i need to ‘import Drupal’ for the first line, but after that i’m not sure what to do. Can anyone offer a simple fla download or give me the initial newbie steps here please.

    thanks

    By Ali on Jul 2, 2008

  36. I’ve got over that first hurdle now, but i’m getting this error:

    error: drupal services
    101
    View does not exist.
    Unknown error type
    /Users/alistairmcclymont/Sites/j2/sites/all/modules/amfphp/amfphp.module
    AMFPHP_RUNTIME_ERROR

    I’ve enabled the views service module. I’ve given full access to anonymous and authenticated users to the following:
    node module - access content
    node_service module - load raw node data
    services module - access services
    system_service module - everything here
    views module - access all views

    I’ve made a view called pages - accessible to everyone - it works here:
    /admin/build/services/browse/views.getView
    and is also accessible when logged out.

    I cant get rid of that error or get any further though. Help…

    By Ali on Jul 2, 2008

  37. ok i finally got this working !
    The problem i had (”View does not exist.”) was caused both by the view filters setup and mostly the Services Keys…
    i had read all over that ‘use keys’ and ‘use sessID’ had to be disabled, but that is the reason the amfphp module wouldn’t connect…. (i am quite new to php so couldn’t really hack). Everything works fine now that i checked both to enable them.

    For now, created a view called ‘Pages’, set up as a block with 5 nodes (View types work as full Nodes or List). Then added filter “Node:Type” equal to the Content Types i had created (or use default Story)
    i’ll do some more testing and post here if i find anything more….
    hope it’ll help !

    By Vincent on Jul 3, 2008

  38. Thanks Vincent - that did it for me too. You have to turn on Keys and sessid in Services to get it working.

    By Ali on Jul 8, 2008

  39. Hi,

    I tried to make all this worked but I still getting this error :

    ERROR:drupal.Drupal:netconnection:
    C:\Program Files\EasyPHP 2.0b1\www\lab\drupal\site\sites\all\modules\amfphp\amfphp\core\shared\app\BasicActions.php
    User Error
    The class {system} could not be found under the class path {C:\Program Files\EasyPHP 2.0b1\www\lab\drupal\site\sites\all\modules\amfphp\amfphp\services/system.php}
    33
    AMFPHP_FILE_NOT_FOUND

    I certainly miss something! Have a clue someone?

    By Frank on Jul 23, 2008

  40. I love the work you and others are doing in this area. Has the “flash site module” from thirdavedesign been made available anywhere as of yet? Even if it is not, some pseudocode would be helpful. Is this module integrating SWFObject & SWFAddress as a sort of utility/helper/API module?

    Thanks Again for the 411.

    Johnny L

    By John Leavitt on Aug 6, 2008

  41. I have the some question
    I have get everything setup correctly,and can get the data from the drupal ,but I don’t know how to continue .
    For example where to put the swf file . how to bring flash file in drupal,and make it show up.

    I am new to drupal, so some of my question maybe Stupid. sorry~~~~~~~~~

    Is there any source or blog post available ??

    Tell me how to creat the someThing like flash site module

    By pickgliss on Aug 13, 2008

  42. I have the error i dont understand why ?
    Please Help me
    Thanks

    ERROR:drupal.Drupal:netconnection:
    E:\workspace\Drupal\test\drupal57.test.com\site\sites\all\modules\amfphp\amfphp.module
    Unknown error type
    Method system.connect does not exist.
    101
    AMFPHP_RUNTIME_ERROR

    By Yto on Aug 19, 2008

  43. Ok maybe i’m the last one to understood this and you’ll find this stupid but it takes me so much time to resolve my mistake!! So I’ve to post it.!.!.

    The path of the “gatewayUrl” (in the main class) is not the same of your folder structure! The good one is the Drupal one.!!

    ie
    folder: http://localhost/drupal/sites/all/modules/amfphp/amfphp/gateway.php
    VS
    Drupal: http://localhost/drupal/services/amfphp

    By Frank on Aug 19, 2008

  44. How would node.save work here? I can’t seem to implement it?!

    private function cbConnect():void {

    var addNode:Object;

    addNode=new Object ;

    addNode.type=”game”;
    addNode.title=”test title”;
    //addNode.body=recipe.text;
    addNode.field_date_timer=”00:01:45″;
    // send request
    drupal.service(onFault, “node.save”, addNode);
    }

    I get this:

    TypeError: Error #1034: Type Coercion failed: cannot convert “node.save” to Function.
    at drupal::Drupal/service()
    at Main/::cbConnect()
    at drupal::Drupal/::onConnect()

    Any help please!

    By BeechyBoy on Aug 25, 2008

  45. Ok maybe i’m the last one to understood this but it takes me so much time to resolve my mistake!! So I’ve to post it.!.!.

    The path of the “gatewayUrl” (in the main class) is not the same of your folder structure! The good one is the Drupal one.!!

    ie
    folder: http://localhost/drupal/sites/all/modules/amfphp/amfphp/gateway.php
    VS
    Drupal: http://localhost/drupal/services/amfphp

    By Frank on Aug 25, 2008

  46. Nice, thanks a lot, that also helped me out a bunch. I didn’t know that if you wanted to pass an arg to a view it needs to be an array. It seems so obvious to me now.

    By Jay on Sep 19, 2008

  47. I have tried and tried everything, gone through everything that everyone here has suggested but can’t seem to get past this error:

    DrupalSite
    Alpha 0.5 - release/Public
    8.27.2008
    DrupalSite by Third Ave Design. Licensed under GPLv3.
    Attempting to connect to AMFPHP interface…
    connected = false
    Flash is connected to AMFPHP interface.
    connected = true
    DrupalSite: error while attempting to invoke Drupal service
    description: View does not exist.
    line: 101
    code: AMFPHP_RUNTIME_ERROR
    details: C:\sites\xxxxxxx\sites\default\modules\amfphp\amfphp.module
    level: Unknown error type

    I’ve tried setting up different views, checking all the permissions, triple checking all my code… I just can’t work this out….

    By del on Oct 5, 2008

  48. @del

    do you have clean url’s enabled?

    By Thomas on Oct 5, 2008

  49. @thomas

    yep clean urls enabled… it appears to connect ok but fails when it gets to the getView function… double checked the view name and the service is working ok inside the drupal service pages

    By del on Oct 6, 2008

  50. @thomas

    Ok I’m pretty sure my problem now lies on the flash side as I have got it working in Flex by following this example:
    http://www.adobe.com/devnet/flex/articles/drupal.html

    So somewhere between flash passing the service call and drupal returning it there is a problem.

    All I can think of it flash is not passing the services call correctly for some reason.

    By del on Oct 7, 2008

  51. Sounds like you and I are having the same problem.

    I think I know why it’s happening. You must be using the new views module right? The current DrupalSite class calls views.getView when the new views service labels this as ‘views.get’ now.

    I’ve changed the code in the class to the correct call, but I’m still getting an AMFPHP runtime error. Not sure where to turn….

    By sean on Oct 12, 2008

  52. This is a great web site. I have some great web pages myself if you are interested to share. But I should not go on about my site too much, that is not fair, right?

    By tip on Jan 11, 2009

  53. Hello,

    Sorry for my english…
    For guys who have an AMF_RUNTIME_ERROR 101

    I have same problem :
    /home/_site/*******/all/modules/amfphp/amfphp.module
    Unknown error type
    101
    Method actu.list does not exist.
    AMFPHP_RUNTIME_ERROR

    I think there is a problem with two points in method name. My method is called : services.actu.list and in the report error the method is called actu.list

    A friend said to me that he had the same problem with two dots in method name, he rename methods with only one dot and that work.
    I did not try but it is maybe an issue…

    Try to rename your method name with only one dot

    By vico on Jan 20, 2009

  54. Hello
    I have just tried with a single point in the name of my method and that work very well

    By vico on Jan 20, 2009

  55. system.mail doesnt work with keys and ssid enabled. in drupal error log the services.module throws “Missing required arguments”. No idea where to get further.
    I`m using drupal 6.

    Thanks anyway for the great implemention :)

    By Valters Boze on Jan 20, 2009

  56. error: drupal services
    Access denied.
    101
    AMFPHP_RUNTIME_ERROR
    C:\xampp\htdocs\drupal\sites\all\modules\amfphp\amfphp.module
    Unknown error type

    Well, I’ve checked all premissions, views.get works when calling ‘pages’ in drupal, and in AMFPHP get’s this error.
    dru.service(cbArticles, onFault, “views.get”, “pages”);

    I’ll continue to check everything.
    Drupal 6.x (views.get method)

    By nmpribeiro on Jan 22, 2009

  57. Ok, i’ve managed to get pages view, that I configured to get all pages through the views service. However I’ve used the base code from http://thanksfornotsuing.com/discussion/flash-integration-drupal-6
    The question is in the arguments with the views service. My guess is the code should have sessionID as one of the argument to the views.get method in drupal 6.x. Views.get in services within drupal seams to not ask about API key. And folowing the code, it seeams that that string is beeng feed to the services function in Drupal.as. It seeams a bit confusing that action script. However, the services arguments seeam to have an order. In views.get is something like (SessionID, View_name); I am very new to drupal, however I see this tutorial as for drupal 5.x

    By nmpribeiro on Jan 23, 2009

  58. hi,

    i’m trying to implement drupal 6 with swfaddress module.

    how do you detect the urls inside the swf?
    eg: if the user saves the bookmark “http://mysite.com/#/mypage
    how do i redirect the swf to this page?

    do you know how?
    thanks

    By Carlos on Feb 27, 2009

  59. I don’t understand. The drupal 5 installation is properly working.

    But when I create a simple FLA referncing the AS3 class Main :

    I suppose this must be something like this … no ? :

    ***********************************
    package
    {

    import Drupal;
    import flash.display.MovieClip;

    public class Main extends MovieClip
    {
    private var dru:Drupal;

    public function main()
    {
    setUpDrupal()
    }

    private function setUpDrupal()
    {
    dru = new drupal();
    dru.gatewayUrl = gatewayUrl; dru.apiKey = apiKey;
    dru.connect(onConnection);
    }

    private function onConnection()
    {
    dru.service(getArticles, onFault, “views.getView”, “pages”);
    }

    private function onFault(e:Error)
    {
    trace(”there has been an error “+e);
    }

    private function getArticles(result:Object)
    {
    for(var prop in result)
    {
    trace(”title is “+prop.title);
    trace(”body is “+prop.body);
    }
    }
    }
    }
    *************************************
    I get the following errors :
    line 19 1180: Call to a possibly undefined method drupal.
    line 20 : 1120: Access of undefined property gatewayUrl.
    line 21 : 1120: Access of undefined property apiKey.
    ————————————-
    The Drupal.as File is in the same directory as the Main.as.

    Please enlighten me…I really need an example that works I’m pulling my hair out ;)

    I’m clearly missing something , but I’m rather new in AS3 and I had a dream that drupal and Flash were talking to eachother …;)

    That would be so cool !

    Thanx a million for helping me out !

    By Dauli on Mar 23, 2009

  60. Hello,

    I am trying to use your code but am running into a few problems. Flash seems to connect to drupal, but then i try to call the node.get service, using this code :

    dru.service(getArticles, onFault, “node.get”, 1);

    I get this error:

    there has been an error [object Object]
    description: Access denied.
    line: 107
    code: AMFPHP_RUNTIME_ERROR
    details: /sites/all/modules/amfphp/amfphp.module
    level: Unknown error type

    I’m new to actionscript, and would really appreciate any advice you could give. I’m not sure if my problem is in my code or in my drupal setup.

    By glazer on Mar 23, 2009

  61. I love this site. I am going to ask my readers to take a look at this. We are going to ran a competition. Don’t change.
    regards
    Michael.

    By Michael Podgoetsky on Mar 25, 2009

  62. Thanks for the guide.
    I’d like to use swfaddress for SEO purposes on a flash-drupal site I created.
    I tried searching your site above on Google and I saw that the content does get indexed but the URLs presented by Google take me to the wrong page.
    Any thoughts on that?

    Thanks.

    By Udi on Oct 18, 2009

  63. This tutorial is really great !
    Unfortonatly i developped my flash in AS2 (i’m still learning !)
    I’ve tried a long time to find the same kind of tutorial with AS2. But it’s not as well described ..
    So i ask you if it would exist an “old version” of Drupal.as in AS2 ? Or what should i put instead ?

    That would really help me if you have any information

    Thanks a lot
    Ps : sorry for my english level :-)

    By chonchon on Nov 26, 2009

  1. 6 Trackback(s)

  2. Apr 19, 2008: Dinesh.co.za » Blog Archive » Drupal Actionscript Class
  3. Jul 3, 2008: links for 2008-07-04 « M@’s Blog
  4. Jul 30, 2008: Tutorials | AS3 and AMFPHP Roundup « Flash Enabled Blog
  5. Nov 17, 2008: Flash Tips » AS3 and AMFPHP roundup
  6. Jan 29, 2009: Edwin C. Cheung Blog » Blog Archive » AMFPHP 1.9 Beta
  7. May 9, 2009: Combining Drupal, AMFPHP, SWFAddress and Flash | talk of modern-carpentry

Post a Comment

levitra and sperm count online rx phentermine recreational use of xanax drugs used to treat bipolar disorder soma discount medicines for bipolar disorder discount xanax buying viagra prescription clomiphene effects levitra alcohol buy cialis canada medication levothyroxine phentermine florida antidepressant pill high levitra spray buy echinacea viagra soft tabs california levitra vardenafil hcl prescription flomax drug gabapentin allergies in cats buy zebeta asthma attack treatment female viagra uk zolpidem diazepam purchase online info soma viagra price buy rhinocort cialis day next rhinocort cheap depo provera and menopause buy viagra online ultram cheap online prilosec nexium express pharmacy services discount generic cialis rimonabant with no prescription xanax online overnight shipping anafranil pulmonary hypertension treatment viagra uk order vermox tablets celexa success drug valsartan ultram effects quit smoking drugs ovulation clomid imipramine side effects use clomid metronidazole dose viamax power discount best price lincocin gay viagra propecia generic cialis liquid natural remedies for allergies luvox ocd allopurinol dosage ambien 10 mg nizoral online coupon zyrtec tramadol money order anti depressant list phentermine 37.5mg tabs anxiety attacks buy ropinirole order uroxatral easy way to stop smoking xanax overnight shipping prescription phentermine phentermine pill online discount order viagra jelly chronic asthma treatment online ambien without a prescription how to increase sperm count penis enlargement pill product valium 5mg cleocin zyprexa levitra professional overnight delivery emsam manufacturer of revatio estradiol ativan treats anti depressant effexor viagra soft tablets propecia merck tramadol fast impotence therapy alprazolam xanax tramadol effects xanax online mexico asthma inhalers loratadine medicine buy progesterone generic ativan buy erythromycin without a prescription zyrtec and benadryl levitra viagra online no prescription soma phentermine 37.5mg overnight shipping cialis ambien discount prevacid 30mg sams club pharmacy ear infection amoxicillin pharmacy lipitor price of cialis treating high uric acid manufactures of viagra cialis levitra online hoodia effective levitra sales discount anxiety drugs benfotiamine viagra free samples phentermine 90 pills gerd natural cure male enhancement drugs celebrex discount what is zyrtec viagra viagra anti anxiety medications purchase online what is robaxin for yasmin side effects gabapentin side effects canadian pharmacy no prescription cytoxan side effects valium dosage order zanaflex cymbalta anxiety cialis free samples allergy tablets cefdinir antibiotic purchase nolvadex inderal klonopin xanax overdose does diflucan phenergan 25mg cialis reaction pill actos hoodia canada cialis 5 sex stamina anxiety and zoloft facts valium express pharmacy services hoodia slim buy ashwagandha drug alprazolam seizures lamictal viagra effects on women