Drupalcon 2009 Flash and Drupal
description
Transcript of Drupalcon 2009 Flash and Drupal
![Page 2: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/2.jpg)
Agenda
• Why Flash and Drupal?• How Flash and Drupal Communicate• Web Services in Drupal• Asynchronous Programming• Building a real Flash application for Drupal
![Page 3: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/3.jpg)
Why Flash with Drupal?
![Page 4: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/4.jpg)
Why Flash with Drupal?
• Flash is like …
![Page 5: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/5.jpg)
Why Flash with Drupal?
• Flash is like … my wife
![Page 6: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/6.jpg)
Why Flash with Drupal?
• Flash is like … my wife– It’s pretty.
![Page 7: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/7.jpg)
Why Flash with Drupal?
• Flash is like … my wife– It’s pretty.– What you see is what you get.
![Page 8: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/8.jpg)
Why Flash with Drupal?
• Flash is like … my wife– It’s pretty.– What you see is what you get. (WYSIWYG)
![Page 9: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/9.jpg)
Why Flash with Drupal?
• Flash is like … my wife– It’s pretty.– What you see is what you get. (WYSIWYG)
• Drupal is like …
![Page 10: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/10.jpg)
Why Flash with Drupal?
• Flash is like … my wife– It’s pretty.– What you see is what you get. (WYSIWYG)
• Drupal is like … me!
![Page 11: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/11.jpg)
Why Flash with Drupal?
• Flash is like … my wife– It’s pretty.– What you see is what you get. (WYSIWYG)
• Drupal is like … me!– It’s nerdy.
![Page 12: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/12.jpg)
Why Flash with Drupal?
• Flash is like … my wife– It’s pretty.– What you see is what you get. (WYSIWYG)
• Drupal is like … me!– It’s nerdy.– Complicated
![Page 13: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/13.jpg)
Why Flash with Drupal?
• Flash is like … my wife– It’s pretty.– What you see is what you get. (WYSIWYG)
• Drupal is like … me!– It’s nerdy.– Complicated– but totally awesome!
![Page 14: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/14.jpg)
Combine Beauty with Power and you get…
![Page 15: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/15.jpg)
Combine Beauty with Power and you get…
![Page 16: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/16.jpg)
Combine Beauty with Power and you get…
![Page 17: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/17.jpg)
How Flash and Drupal communicate
![Page 18: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/18.jpg)
How Flash and Drupal communicate
• Remote Function Calls (RPC)– Uses XML to call a remote function– AMF ( ActionScript Message Format )
![Page 19: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/19.jpg)
How Flash and Drupal communicate
• Remote Function Calls (RPC)– Uses XML to call a remote function– AMF ( ActionScript Message Format )
![Page 20: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/20.jpg)
How Flash and Drupal communicate
• Remote Function Calls (RPC)– Uses XML to call a remote function– AMF ( ActionScript Message Format )
<function>getHello</function>
![Page 21: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/21.jpg)
How Flash and Drupal communicate
• Remote Function Calls (RPC)– Uses XML to call a remote function– AMF ( ActionScript Message Format )
<function>getHello</function>
“Hello World!”
![Page 22: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/22.jpg)
How Drupal handles Flash RPC…
![Page 23: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/23.jpg)
How Drupal handles Flash RPC…
• Services Module
![Page 24: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/24.jpg)
How Drupal handles Flash RPC…
• Services Module• AMFPHP Module
![Page 25: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/25.jpg)
How Drupal handles Flash RPC…
• Services Module• AMFPHP Module• AMFPHP ( http://www.amfphp.org )
![Page 26: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/26.jpg)
How Drupal handles Flash RPC…
![Page 27: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/27.jpg)
How Drupal handles Flash RPC…
• Services module comes with “external” API’s so that Flash can get Drupal data.
![Page 28: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/28.jpg)
How Drupal handles Flash RPC…
• Services module comes with “external” API’s so that Flash can get Drupal data.– node.get– node.save– views.get– etc…
![Page 29: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/29.jpg)
Connecting to Drupal
• Flash must first establish a connection with Drupal.
• Drupal manages the Flash connection using Session ID’s
![Page 30: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/30.jpg)
Session Handling
![Page 31: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/31.jpg)
Session Handling
• Flash calls “system.connect”
![Page 32: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/32.jpg)
Session Handling
• Flash calls “system.connect”• Drupal returns a valid Session ID to Flash
![Page 33: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/33.jpg)
Session Handling
• Flash calls “system.connect”• Drupal returns a valid Session ID to Flash• Flash stores the session ID, then uses it for all
other calls to Drupal.
![Page 34: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/34.jpg)
On the Flash Side…
![Page 35: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/35.jpg)
On the Flash Side…
• Uses NetConnection to connect to flash
![Page 36: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/36.jpg)
On the Flash Side…
• Uses NetConnection to connect to flash
• Create responder to handle callbacks
![Page 37: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/37.jpg)
On the Flash Side…
• Uses NetConnection to connect to flash
• Create responder to handle callbacks
• Make the Service Call
![Page 38: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/38.jpg)
Drupals response is handled using callback functions
![Page 39: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/39.jpg)
Asynchronous Programming
![Page 40: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/40.jpg)
Asynchronous Programming• Flash triggers actions based on events ( Event
Driven )• Events move the system along
![Page 41: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/41.jpg)
Asynchronous Programming• Flash triggers actions based on events ( Event
Driven )• Events move the system along
![Page 42: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/42.jpg)
Asynchronous Programming• Flash triggers actions based on events ( Event
Driven )• Events move the system along
Register for event
![Page 43: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/43.jpg)
Asynchronous Programming• Flash triggers actions based on events ( Event
Driven )• Events move the system along
Register for event
Make the call…
![Page 44: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/44.jpg)
Asynchronous Programming• Flash triggers actions based on events ( Event
Driven )• Events move the system along
Register for event
Make the call…
Twiddle your thumbs…
![Page 45: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/45.jpg)
Asynchronous Programming• Flash triggers actions based on events ( Event
Driven )• Events move the system along
Register for event
Make the call…
Twiddle your thumbs…
An event! Let’s do something!
![Page 46: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/46.jpg)
Let’s build something!
![Page 47: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/47.jpg)
Let’s build something!
Meet my wife…
![Page 48: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/48.jpg)
Let’s build something!
Meet my wife…
![Page 49: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/49.jpg)
Let’s build something!
Meet my wife… She is Flash…
![Page 50: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/50.jpg)
Let’s build something!
Meet me…
![Page 51: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/51.jpg)
Let’s build something!
Meet me…
![Page 52: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/52.jpg)
Let’s build something!
Meet me… I am Drupal…
![Page 53: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/53.jpg)
Demo Time!
![Page 54: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/54.jpg)
For more information…• “Flash with Drupal” Book– Author: Travis Tidwell (me)– Packt Publishing– Due July this year
• Topics covered• Build a Flash recipe viewer• Build a media player using Nodes and Views• Build a Flash Five Star voter• A bunch of other good stuff…
![Page 55: Drupalcon 2009 Flash and Drupal](https://reader035.fdocuments.net/reader035/viewer/2022062319/555a8d8ed8b42a991b8b46cd/html5/thumbnails/55.jpg)
Questions?