www.it-ebooks.info www.it-ebooks.info Developing iOS Applications with Flex 4.5 www.it-ebooks.info www.it-ebooks.info Adobe Developer Library, a copublishing partnership between O’Reilly Media Inc., and Adobe Systems, Inc., is the authoritative resource for developers using Adobe technologies. These comprehensive resources offer learning solutions to help devel- opers create cutting-edge interactive web applications that can reach virtually any- one on any platform. With top-quality books and innovative online resources covering the latest tools for rich-Internet application development, the Adobe Developer Library delivers expert training straight from the source. Topics include ActionScript, Adobe Flex®, Adobe Flash®, and Adobe Acrobat®. Get the latest news about books, online resources, and more at http://adobedeveloper library.com. Untitled-1 1 3/3/09 5:37:20 PM www.it-ebooks.info www.it-ebooks.info Developing iOS Applications with Flex 4.5 Rich Tretola Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo www.it-ebooks.info Developing iOS Applications with Flex 4.5 by Rich Tretola Copyright © 2011 Rich Tretola. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com. Editor: Mary Treseler Production Editor: Kristen Borg Proofreader: O’Reilly Production Services Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Developing iOS Applications with Flex 4.5, the image of a ruff, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-1-449-30836-0 [LSI] 1313508107 www.it-ebooks.info I would like to dedicate this book to our beloved family cats Mickey and Hattrick, who both passed away during the writing of this book. They were both loved very much and will be missed. www.it-ebooks.info www.it-ebooks.info [...]... Applications with Flex 4.5 is a book targeting all levels of developers It starts with a basic Hello World application and then quickly moves to more complicated examples where the iOS APIs are explored Who This Book Is Not For This book is not for developers who are interested in developing native iOS applications This book will only provide examples of iOS application development using Adobe Flex 4.5 and ActionScript... to iOS This book will walk you through the creation of your first Adobe AIR application using the Flex 4.5 framework and provide examples of how to interact with the device’s components These include GPS, the camera, the gallery, the accelerometer, the multitouch display, the StageWebView, operating system interactions, native components, and more Who This Book Is For Developing iOS Applications with. .. have Flash Builder 4.5, you can get a trial from Adobe at http://www.adobe.com/products/flashbuilder/ Now that you have Flash Builder 4.5 installed, open it and let’s get started Create a Flex Mobile Project Create a new Flex Mobile Project by choosing File→New Flex Mobile Project, as shown in Figure 1-1 Figure 1-1 Create a Flex Mobile Project 1 www.it-ebooks.info This will open the New Flex Mobile Project... your product’s documentation does require permission We appreciate, but do not require, attribution An attribution usually includes the title, author, publisher, and ISBN For example: Developing iOS Applications with Flex 4.5 by Rich Tretola (O’Reilly) Copyright 2011 Rich Tretola, 978-1-449-30836-0.” If you think your use of code examples falls outside fair use or the permission given here, feel free... have a device registered with Apple You can add a device by registering it within the Devices section of the iOS Provisioning Portal, as shown in Figure 1-15 Figure 1-15 Add a device Create a new App ID Now that you have a device added, you will need to create a new App ID within the App IDs area of the iOS Provisioning Portal Click on the App IDs menu on the left side of the iOS Provisioning Portal,... thanks to the Adobe Flex team and the members of the Flex CAB who provided early access and support to the AIR 2.7 and Flash Builder 4.5 tools and documentation Thank you as well to Mary Treseler from O’Reilly for providing this opportunity xiv | Preface www.it-ebooks.info CHAPTER 1 Hello World This section will walk you through building your first iOS application using Adobe Flash Builder 4.5 If you don’t... 81 82 83 86 87 89 91 93 93 95 97 7 Designing for iOS 99 MultiDPIBitmap Setting Styles for iOS Using Capabilities 99 101 106 8 Publish to iOS Installer 109 x | Table of Contents www.it-ebooks.info Preface Introduction to iOS Apple originally introduced iOS in January of 2007 as the operating system for... www.it-ebooks.info Testing with adl You can test some basic functionality of your application within Flash Builder using the adl simulator—however, for full testing and packaging of your iOS application, you will need to purchase an Apple developer certificate and an Apple device In this example, I will be using an iPod touch running the latest iOS operating system To test with adl, simply click on... xi 1 Hello World 1 Create a Flex Mobile Project Testing with adl Preparing to Test on an iOS device Testing on an iOS device Debugging on an iOS device 1 8 10 15 20 2 Application Layouts 27 Blank Application View-Based Application View... Apple iOS as the target platform; and On desktop and Apple iPhone 3GS as the Launch Method, as shown in Figure 1-9 Now click Run and you will see the application running within adl, as shown in Figure 1-10 Figure 1-8 Run As Mobile Application 8 | Chapter 1: Hello World www.it-ebooks.info Figure 1-9 Configure runtime environment Create a Flex Mobile Project | 9 www.it-ebooks.info Figure 1-10 Running within . PM www.it-ebooks.info www.it-ebooks.info Developing iOS Applications with Flex 4. 5 Rich Tretola Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo www.it-ebooks.info Developing iOS Applications with Flex 4. 5 by Rich. title, author, publisher, and ISBN. For example: Developing iOS Applications with Flex 4. 5 by Rich Tretola (O’Reilly). Copyright 2011 Rich Tretola, 978-1 -44 9-30836-0.” If you think your use of code. . . . . . 47 Accelerometer 47 GPS 49 Camera UI 52 Camera Roll 57 Microphone 60 Multitouch 62 GestureEvent 62 ix www.it-ebooks.info TransformGesture 65 Busy Indicator 69 5. Working with the File