Drupal And Flash Platform hybrid applications


Published on

An overview of building applications using Drupal and the flash platform.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Drupal And Flash Platform hybrid applications

  1. 1. Drupal and Flash Platformhybrid applications<br />Pacific North West Drupal Summit<br />10/24/2009<br />Josh Kopel<br />
  2. 2. Hybrid application<br />Drupal provides a powerful way to source and manage data for SWF applications<br />Flash player provides a “rich” environment for advanced interactions<br />Multi-touch<br />Desktop migration (Air)<br />iPhone (!)<br />
  3. 3. Flashgood or evil?<br />
  4. 4. Flashgood or evil?<br />
  5. 5. Why call it SWF<br />“Flash platform”<br />Anything that compiles to the SWF format for playback within the Flash Player<br />Flash<br />Flex<br />Flash has often meant animation. We are talking about true applications.<br />
  6. 6. Quick demo<br />
  7. 7. Overview of SWF Drupal<br />Drupal<br />Browser<br />Services Module<br />HTML Page<br />Server Module<br />Flash Player<br />Un/serialization<br />AS3 Application Code<br />Auth. Module<br />Un/Serialization<br />Classes<br />Service (Module)<br />
  8. 8. Services means<br />Reusable data (SWF or AJAX)<br />Provide the same “site” to multiple client technologies<br />Data is available at either end in the same format via serialization<br />Objects<br />Arrays<br />Number types<br />Strings<br />
  9. 9. The Drupal side<br />Services module<br />Authentication module(s)<br />Service module(s)<br />Server module(s)<br />External (un)serialize code (i.e. AMFPHP)<br />
  10. 10. The Drupal side<br />Drupal<br />Services Module<br />Server Module<br />Un/serialization<br />Auth. Module<br />Service (Module)<br />
  11. 11. Services Module An API for remote applications<br />Provides end point for service calls<br />Wraps server and service modules in a standard API<br />Supports multiple authentication methods*<br />*We can hazoauth?<br />
  12. 12. Services Module core services<br />system<br />system.connect<br />file<br />file.get<br />file.getNodeFiles<br />menu<br />menu.get<br />node<br />node.get<br />node.view<br />node.save<br />node.delete<br />search<br />search.nodes<br />search.content<br />search.users<br />taxonomy<br />taxonomy.saveTerm<br />taxonomy.saveVocabulary<br />taxonomy.getTree<br />taxonomy.selectNodes<br />views<br />views.get<br />views.export<br />views.import<br />
  13. 13. Server modules<br />Provide wrappers for specific languages or serialization methods<br />AMF (Adobe Message Format)<br />XMLRPC<br />JSON<br />REST<br />SOAP<br />etc.<br />
  14. 14. Custom service modules<br />Provide access to any Drupal function<br />Provide SIMPLER access to nodes<br />Parse the data on the server side<br />Only send the data needed by the flash app<br />
  15. 15. Authentication<br />API Keys<br />Make a unique key based upon an application name and domain<br />SWF must pass the hashed key back in order to authenticate<br />Key must be embedded in or passed to Flash player<br />
  16. 16. Authentication<br />Session based<br />Use standard Drupal HTML login<br />Pull session ID into SWF<br />via javascript using flash.external.ExternalInterface<br />Via PHP using custom PHP<br />Use existing session for service calls<br />
  17. 17. Authentication<br />Session based<br />Use system.connect() to return an anonymous session ID<br />Pass that back on any service call (logged in as anonymous)<br />Or call user.login with a username/password + session ID<br />Embedded<br />Requested<br />Receive a authenticated session ID<br />
  18. 18. The SWF side<br />All calls brokered by the browser<br />Restricted by player security sandbox (learn about crossdomain.xml)<br />Receive startup parameters from flashVars<br />Manipulate DOM through externalInterface<br />
  19. 19. The SWF side<br />Browser<br />HTML Page (DOM)<br />Flash Player<br />AS3 Application Code<br />Un/Serialization<br />Classes<br />Flash<br />Vars<br />JS<br />
  20. 20. Development methodology<br />AS3 is “stateful”, asynchonous, & event driven<br />learn the language and use a good framework<br />pureMVC<br />robotlegs<br />Existing open source classes are available for almost any protocol<br />
  21. 21. Review authentication needs<br />Do you need to save data or register users?<br />Can you request a username/password?<br />In html<br />In SWF<br />
  22. 22. Review protocol choices<br />AMFPHP <br />Binary protocol means it is fast and compact<br />Not “human readable”<br />Adobe specific (natively parsed)<br />XML<br />Text based protocol can get verbose<br />Easier to debug<br />JSON<br />Text based protocol can get verbose<br />Can be easily consumed by AJAX or other services<br />
  23. 23. Debugging<br />Get the debug player (www.adobe.com/support/flashplayer/downloads.html)<br />Charles Proxy (charlesproxy.com)<br />LiveHTTPHeaders (livehttpheaders.mozdev.org/)<br />Flash Tracer for FF (www.sephiroth.it/firefox/flashtracer/)<br />
  24. 24. Serialization classes<br />AMFPHP – nl.dpdk.services.gephyrcomplete “high level” Drupal connection class using AMFPHP<br />AMFPHP – com.kylebrekke.amfphp<br />XMLRPC – com.mattism.http.xmlrpchttp://danielmclaren.net/2007/08/03/xmlrpc-for-actionscript-30-free-library <br />JSON – as3corlib http://code.google.com/p/as3corelib/<br />
  25. 25. IDEs and compilers<br />Adobe Flash Professional CS4 (if you need timeline/library)<br />Adobe Flash Builder™ 4<br />Other Adobe products<br />Flex SDK complier<br />FlashDevelop (my favorite)<br />Eclipse-ant-Flex SDK<br />Komodo (with plugins)<br />
  26. 26. Other resources<br />Essential ActionScript 3.0 by Colin Moock<br />Flash with Drupal by Travis Tidwell<br />OpenSource Flash http://osflash.org/<br />