1. Building mobile and tablet applications in Flex and PHP with Flash Builder for PHP Kevin Schroeder Zend Technologies
2. About Kevin Past: Programming/Sys Admin Current: Technology Evangelist/Author/Composer @kpschrade
3.
4. Agenda The basics Creating a project Working with MXML Working with ActionScript Connecting to PHP
5. The Basics What is Flash? A platform for building highly interactive web content What is AIR? A runtime of the Flash environment for the desktop What is ActionScript The natively supported programming language for building more than just simple graphic animations What is Flex? An SDK for building Rich Internet Applications in Flash/ActionScript
8. Flex Project Basics AIR projects will have an Application Descriptor file Defines Application Name Versioning Initialization settings Width Height Visible Etc. etc. etc. Etc. etc. etc. Flex/web projects inherit this from the browser
10. MXML An XML-based UI markup language Describes UI elements Position Data Bindings Events Two primary component sets (for widgets) MX – the older brother (Flex 3) Spark – the new hotness (Flex 4) Most of what you need to do will be in Spark
11. MXML Example XML Namespace declaration for Flex (non-visual, generally) XML Namespace declaration for Spark Components
12. MXML – Adding a component Choosing from a list of Spark Components
13. MXML – Creating Flex Elements Defining local ActionScript container Defining local data container
14. MXML – Binding Static Data Declared a data source Accessed the data source
18. ActionScript ActionScript is what makes Flash interesting Strong Typing (optional) Object Oriented Embeddable in MXML or writable in standard class files
19. Language Features Very similar syntax to Java Object Oriented Namespaced Variables defined with a var keyword Variable type definitions are done with a semi-colon Casting is done with an as keyword Event Driven - No threading
20. Language Features Namespace Return Value Type Variable Type Casting Type Declaration Variable Declaration Variable Type Checking Event Based
22. Action Message Format Protocol for serializing objects to/from a Flash player Supports strong typing of data Support in multiple languages Support for any binary transport that ActionScript supports Two versions AMF0 AMF3
23. Zend_Amf A Zend Framework based component to facilitate connections to Flash Two mechanisms Direct Serializer Used for non-service endpoints (SMTP, Stomp, File System) Generally not what you will use Zend_Amf_Server Used for service-based endpoints Manages calls to service classes similar to MVC Generally what you will use
24. Direct Serializer Create an object Create the output stream Create the serializer Write the object Get the output from the stream Weird, but required
25. Reading the (PHP) serialized object Not just for PHP! Regular binary data Magic!
26. PHP Application Building a Service Oriented Architecture Flash Application Service Call 1 Service Call 3 HTTP Gateway Service Class 1 Service Class 2 Service Class 3 Service Class 4
27. A Simple Architecture Libraries and Value Objects* Document Root Services to expose */services is not in the include_path, otherwise value objects would go there
28. Integrating into your own application Define service classes Bootstrap your application Call Zend_Amf_Server
29. Demo : Creating and binding a PHP endpoint (slides would mean endless screen shots that would result in… well… this: