Your First Adobe Flash Application for Android


Published on

@suzalex presentation from #andevcon. More information at

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

Your First Adobe Flash Application for Android

  1. 1. Suzanne AlexandraMotorola<br />Your First Flash Application for Android<br />For Android Developers<br />
  2. 2. @suzalex<br /><br />#AnDevCon<br />Presentation Title Version 1.0 02.24.09<br />
  3. 3. Where's the droid?<br />Hint: Café au lait<br />Presentation Title Version 1.0 02.24.09<br />
  4. 4. Part 1<br />Why?<br />
  5. 5. AIR on mobile devices<br />Adobe AIR for Mobile Devices<br /><br />
  6. 6. Visually stunning · easy to build · Android Market · multiple platforms<br />
  7. 7. The Flash universe<br />Runtimes<br />Adobe® AIR®<br />Adobe® Flash® Player<br />The Flash universe<br />Applications, content, and video<br />Tools<br />Framework<br />Services/Servers<br />Adobe Flash Platform Services<br />Adobe® Flash® CS5 Professional<br />Adobe® Flex®<br />Adobe Flash Media Server family<br />Adobe® LiveCycle® Data Services<br />Adobe® Flash® Builder™<br />
  8. 8. Flash<br />Flex<br />UIs with components<br />Data-driven apps<br />Server-based apps<br />Enterprise apps<br />XML + ActionScript<br />Rich graphics<br />Animations with timeline <br />Video-based apps<br />Games<br />Presentation Title Version 1.0 02.24.09<br />
  9. 9. Access device features<br />Multitouch and gesture<br />Accelerometer<br />Screen orientation<br />Mobile text input<br />Device capabilities discovery<br />Camera – image and video<br />Camera app and camera roll<br />Microphone<br />Geolocation<br />Network connectivity<br />Presentation Title Version 1.0 02.24.09<br />
  10. 10. When you need Android SDK<br />Services<br />Background threads<br />Home screen widgets<br />Content providers<br />Front-facing camera<br />Intents<br />Accessing core apps<br />Broadcast receivers<br />Notifications<br />Status bar<br />Presentation Title Version 1.0 02.24.09<br />
  11. 11. Page 7<br />Where's the droid?<br />Hint: Rhymes with peach<br />Presentation Title Version 1.0 02.24.09<br />
  12. 12. AIR on which devices?<br />Presentation Title Version 1.0 02.24.09<br />
  13. 13. When AIR is not on the device<br />Presentation Title Version 1.0 02.24.09<br />
  14. 14. Part 2<br />How?<br />
  15. 15. Adobe Flash Builder Burrito<br />Adobe Flash Professional CS5<br />Flash Extension for AIR<br />Design and development tool<br /><br /><br />Development tool<br /><br />Presentation Title Version 1.0 02.24.09<br />
  16. 16. AIR on the device<br />Download from Android Market<br />Or install Runtime.apk<br />Presentation Title Version 1.0 02.24.09<br />
  17. 17. The ActionScript class reference<br /><br />
  18. 18. ActionScript and Java both …<br />Are object-oriented<br />Have packages, classes, and interfaces<br />Use single inheritance<br />Have a base Object class<br />Are strongly typed<br />Presentation Title Version 1.0 02.24.09<br />
  19. 19. Comparing the syntax of Java <br />and ActionScript 3<br /><br />But ActionScript has …<br />Dynamic classes<br />Get / set functions<br />No method overloading<br />No threads<br />Presentation Title Version 1.0 02.24.09<br />
  20. 20. The stage<br />First, a few key concepts<br />Presentation Title Version 1.0 02.24.09<br />
  21. 21. Declaring variables<br />Java<br />public int number;<br />public Object foo = <br /> new Object();<br />ActionScript<br />public var number:int;<br />public var foo:Object = new Object();<br />Presentation Title Version 1.0 02.24.09<br />
  22. 22. Declaring methods<br />Java<br />public int add( int first, int second ) {<br /> int sum = first + second;<br /> return sum;<br /> }<br />ActionScript<br />public function add( one:Number, two:Number):Number{<br /> var f:Number = one;<br /> var s:Number = two;<br /> var sum:Number = f + s;<br /> return sum;<br />}<br />Presentation Title Version 1.0 02.24.09<br />
  23. 23. DemoBuilding a first app<br />Hint: Oolong tea<br />Presentation Title Version 1.0 02.24.09<br />
  24. 24. AndroidManifest settings in app.xml<br /><android> <br /> <manifestAdditions> <br /> <![CDATA[ <br /> <manifest> <br />… your tags here …<br /> </manifest> <br /> ]]> <br /> </manifestAdditions> <br /></android><br />Java<br />Presentation Title Version 1.0 02.24.09<br />
  25. 25. Add permissions, for example<br /><android> <br /> <manifestAdditions> <br /> <![CDATA[ <br /> <manifest> <br /> <uses-permission<br /> android:name="android.permission.INTERNET"/><br /> </manifest> <br /> ]]> <br /> </manifestAdditions> <br /></android><br />Java<br />Presentation Title Version 1.0 02.24.09<br />
  26. 26. DemoDebugging on the device<br />Hint: Tequilas, tacos<br />Presentation Title Version 1.0 02.24.09<br />
  27. 27. Part 3<br />What about … ?<br />
  28. 28. The activity lifecycle<br />It's managed for you!<br />Nothing to do<br />Presentation Title Version 1.0 02.24.09<br />
  29. 29. The Back key<br />Back exits the app by default<br />You can access Back and define actions<br />Presentation Title Version 1.0 02.24.09<br />
  30. 30. Using the Back key<br />private function onKeyDown(event:KeyboardEvent):void {<br /> if ( event.keyCode == Keyboard.BACK ) {<br /> event.preventDefault();<br /> // do something<br /> }<br />}<br />Java<br />Presentation Title Version 1.0 02.24.09<br />
  31. 31. Detecting screen resolution<br />trace("screenResolutionX: " + Capabilities.screenResolutionX);<br />trace("screenResolutionY: " + Capabilities.screenResolutionY);<br />Java<br />On XOOM<br />screenResolutionX: 1280<br />screenResolutionY: 800<br />Presentation Title Version 1.0 02.24.09<br />
  32. 32. Detecting supported gestures<br />import flash.ui.MultiTouch;<br />if (Multitouch.supportsGestureEvents == true) {<br /> trace("Supported gestures" + Multitouch.supportedGestures );<br />}<br />Java<br />On XOOM<br />gestureZoom, gesturePan, gestureRotate, gestureTwoFingerTap, gestureSwipe<br />Presentation Title Version 1.0 02.24.09<br />
  33. 33. Multitouch<br />Michael Chaize<br /><br />Great resources<br />Games<br />Hemant Sharma<br />Crazy Gems<br /><br />Games<br />Paul Trani<br />Doodle Galaxy Invaders<br /><br />Presentation Title Version 1.0 02.24.09<br />
  34. 34. Okay, now …Where was the droid?<br />
  35. 35. Questions?<br />@suzalex<br />@motodev<br /><br /><br /><br />
  36. 36. MOTOROLA MOBILITY DEVELOPER NETWORK<br />Detailed product specs<br />Practical advice, technical articles, and documentation<br />Expert support via forums<br />Community interaction via blogs, podcasts, and social media<br />Global news, events, and training <br />Web:<br />Twitter: @motodev<br />
  37. 37. GET STARTED NOW!<br />Test Your Apps on the MOTODEV App Validator<br />Join the MOTODEV CommunityAsk questions, read our blogs, and network<br />Join our live chat with technical experts at the MOTODEV Office Hours March 16 2pm PSTDetails at<br />Twitter: @motodev<br />#andevcon<br />
  38. 38. thank you<br />
  39. 39. BSD LICENSE<br />Except when otherwise noted, sample source code is provided under the following terms.<br /> Copyright (c) 2011, Motorola Mobility, Inc. All  rights reserved.<br /> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:<br /> Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.<br /> Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.<br /> Neither the name of the Motorola, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.<br /> THIS  SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH  DAMAGE.<br />
  40. 40. APACHE 2 LICENSE<br />Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at<br /> Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.<br />