Flash iOS Apps Cookbook - Christopher Caleb - E-Book

Flash iOS Apps Cookbook E-Book

Christopher Caleb

0,0
39,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

The latest version of Flash Professional can directly target iOS, allowing Flash developers to write applications that will run natively on Apple's iPhone, iPad, and iPod touch. What's more, with Apple loosening its restrictions on third-party technologies, apps written in Flash can now be sold and distributed within the App Store.Flash iOS Apps Cookbook provides the recipes required to build native iOS apps using your existing knowledge of the Flash platform. Whether you want to create something new or simply convert an existing Flash project, the relevant steps and techniques will be covered, helping you achieve your goal.Learn how to configure and use Flash Professional for iOS development by writing and deploying a simple app to a device. Implement many iOS-specific features such a multi-touch, the virtual keyboard, camera support, screen orientation and the Retina display. Overcome the limitations of mobile development by mastering hardware acceleration and optimization. Whether you're an enthusiast or professional developer, the Flash iOS Apps Cookbook is your toolkit to creating high-quality content for iPhone, iPad and iPod touch.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 569

Veröffentlichungsjahr: 2012

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Flash iOS Apps Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with iOS App Development
Introduction
Joining the iOS Developer Program
Getting ready
How to do it...
Register as an Apple developer
Select your program
Complete your purchase
How it works...
There's more...
Working with multiple team members
iOS SDK, tools, and documentation
Accessing the iOS Provisioning Portal
Getting ready
How to do it...
How it works...
There's more...
Resources
Adding team members
Distribution
Technical support
Generating a Certificate Signing Request using Windows
Getting ready
How to do it...
How it works...
See also
Generating a Certificate Signing Request using Mac OS X
How to do it...
How it works...
See also
Obtaining your development certificate
Getting ready
How to do it...
How it works...
There's more...
Approving Certificate Signing Requests
Team roles
Distribution certificates
Creating a P12 certificate using Windows
Getting ready
How to do it...
How it works...
There's more...
Certificate expiration
Creating a P12 certificate using Mac OS X
Getting ready
How to do it...
How it works...
There's more...
Certificate expiration
Registering a device
Getting ready
How to do it...
How it works...
There's more...
Adding devices in a team environment
Editing device names
Device limit
UDID Sender
Creating an App ID
How to do it...
How it works...
There's more...
Bundle Identifier naming convention
App distribution
Editing App IDs
Creating a development provisioning profile
Getting ready
How to do it...
How it works...
There's more...
Profile expiration
Editing provisioning profiles
Additional provisioning profile types
Working with multiple team members
Installing a provisioning profile on your device
Getting ready
How to do it...
How it works...
There's more...
Removing provisioning profiles
iPhone Configuration Utility
2. Building iOS Apps Using Flash
Introduction
Installing the AIR SDK
Getting ready
How to do it...
Updating Flash Professional
Overlaying the AIR SDK
How it works...
Creating an AIR for iOS document
Getting ready
How to do it...
How it works...
There's more...
Stage dimensions
Frame rate
See also
Adding content to the stage
Getting ready
How to do it...
How it works...
See also
AIR for iOS general settings
Getting ready
How to do it...
How it works...
There's more...
Adding the status bar
Including files
See also
AIR for iOS deployment settings
Getting ready
How to do it...
How it works...
There's more...
Specifying an App ID
Deployment types
See also
Compiling from Flash Professional
Getting ready
How to do it...
How it works...
There's more...
The LLVM compiler infrastructure
Installing your app with iTunes
Getting ready
How to do it...
How it works...
There's more...
Updating version numbers
iPhone Configuration Utility
TestFlight
3. Writing your First App
Introduction
Creating a basic document class
Getting ready
How to do it...
How it works...
There's more...
Naming the document class
Using packages
Editing with Flash Builder
Creating other ActionScript 3.0 classes
See also
Preventing screen idle
Getting ready
How to do it...
How it works...
Handling multitasking
Getting ready
How to do it...
How it works...
There's more...
Background processing
App closing
Exiting gracefully from an app
Getting ready
How to do it...
How it works...
There's more...
The app switcher
Cleaning up
Script execution time
Linking classes to movie-clip symbols
How to do it...
How it works...
There's more...
Extending sprite
Using an update loop
How to do it...
How it works...
Including an application launch image
How to do it...
How it works...
There's more...
Landscape orientation
Supporting the Retina display
iPad launch images
Universal apps
Using the status bar
Bundling other files
See also
Including icons
How to do it...
How it works...
Editing the application descriptor file
Getting ready
How to do it...
How it works...
There's more...
Status bar style
See also
Remote debugging
Getting ready
How to do it...
Creating a debug build
Connecting to the Remote Debugger
How it works...
There's more...
Remote connection attempts
4. Porting Flash Projects to iOS
Introduction
Handling user interaction
Getting ready
How to do it...
Creating the button movie clip
Linking a class to the button
How it works...
There's more...
Re-using the button class
Handling keyboard controls
See also
Saving application state
Getting ready
How to do it...
How it works...
See also
Flattening the display list
Getting ready
How to do it...
How it works...
Converting vectors to bitmaps
Getting ready
How to do it...
How it works...
There's more...
Export as Bitmap
Convert to Bitmap
Working with timeline animation
Targeting multiple screen sizes
Pre-rendering filters and blends
See also
Resizing bitmaps
Getting ready
How to do it...
How it works...
There's more...
Targeting multiple screen sizes
Optimizing vector shapes
Stage quality
See also
Masking content
Getting ready
How to do it...
How it works...
See also
Working with external SWFs
Getting ready
How to do it...
Publishing a SWC
Statically linking the SWC
How it works...
There's more...
See also
5. Multi-touch and Gesture Support
Introduction
Setting the touch point input mode
Getting ready
How to do it...
How it works...
There's more...
Available touch events
Determining the number of supported touch points
Touch point hit targets
Mouse events
Testing in ADL
See also
Detecting multiple touch points
Getting ready
How to do it...
Updating the Bubble class
Responding to multiple touch events
How it works...
Handling roll out
There's more...
Primary touch point
Touch point ID
Local touch coordinates
Global touch coordinates
See also
Dragging multiple display objects
Getting ready
How to do it...
How it works...
There's more...
startTouchDrag() parameters
See also
Tracking movement
Getting ready
How to do it...
How it works...
See also
Setting the gesture input mode
Getting ready
How to do it...
How it works...
There's more...
Available gesture events and types
Determining the supported gestures
Mouse events
Testing in ADL
See also
Handling a swipe gesture
Getting ready
How to do it...
How it works...
There's more...
Swiping vertically
See also
Panning an object
Getting ready
How to do it...
How it works...
There's more...
Gesture phases
Single finger panning
See also
Rotating an object
Getting ready
How to do it...
How it works...
See also
Zooming an object
Getting ready
How to do it...
How it works...
See also
6. Graphics and Hardware Acceleration
Introduction
Comparing vector and bitmap graphics
Getting ready
How to do it...
How it works...
There's more...
Stage quality
See also
Understanding GPU-Blend mode
Getting ready
How to do it...
How it works...
The rendering process
CPU mode and GPU-Blend mode
Redrawing dirty regions
There's more...
Auto rendering
See also
Understanding GPU-Vector mode
Getting ready
How to do it...
How it works...
GPU-Vector mode
There's more...
Rendering vectors using GPU-Vector mode
Using GPU-Vector mode with Flash Professional CS5
Stage 3D
See also
Using Cache as Bitmap
Getting ready
How to do it...
How it works...
There's more...
Other transformation changes
Caching display objects that contain children
Taking advantage of GPU Blend
Bitmaps and GPU Vector
Using vectors ahead of bitmaps
See also
Using Cache as Bitmap Matrix
Getting ready
How to do it...
How it works...
There's more...
Selecting a matrix transformation
Changing the Matrix object
Reusing the Matrix object
3D properties
Working with GPU Blend
See also
Accessing bitmaps with ActionScript
Getting ready
How to do it...
Exporting the bitmap
Displaying the bitmap using ActionScript
How it works...
There's more...
Managing image sizes
Size restrictions
Storing bitmap data on the GPU
See also
Loading bitmaps at runtime
Getting ready
How to do it...
Bundling the bitmap
Loading the bitmap at runtime
How it works...
There's more...
Handling load errors
Accessing the bitmap's data
Disposing of bitmap data
See also
Working with sprite sheets
Getting ready
How to do it...
How it works...
There's more...
Creating sprite sheets
Comparing performance and memory consumption
See also
Performing bitmap animation with ActionScript
Getting ready
How to do it...
How it works...
There's more...
Animation sequences
Loading resources at runtime
Stage 3D
See also
7. Working with Text and the Virtual Keyboard
Introduction
Using device fonts within text fields
Getting ready
How to do it...
How it works...
There's more...
Device fonts on iOS
Enumerating the available device fonts
Pixel density
TLF text
See also
Using embedded fonts within text fields
Getting ready
How to do it...
How it works...
There's more...
Size considerations
See also
Providing text entry
Getting ready
How to do it...
How it works...
There's more...
Keyboard types
Launching the virtual keyboard programmatically
See also
Capturing text input
Getting ready
How to do it...
How it works...
There's more...
Listening for focus
See also
Configurable panning with virtual keyboard activation
Getting ready
How to do it...
How it works...
There's more...
Related object
Updating dynamic text fields
Getting ready
How to do it...
How it works...
There's more...
Device fonts
Appending text
Replacing text fields with bitmaps
Cache as Bitmap
See also
Using native iOS text controls
Getting ready
How to do it...
How it works...
There's more...
Virtual keyboard types
Return key label types
Enumerating device fonts
Events
Auto-correction and auto-capitalization
See also
8. Screen Resolution and Orientation Changes
Introduction
Targeting a device
Getting ready
How to do it...
Setting the target devices
Detecting the current device
How it works...
There's more...
Application launch image
Including icons
Landscape aspect ratio
See also
Targeting the Retina display
Getting ready
How to do it...
Setting Retina display support
Detecting a Retina display device
How it works...
There's more...
Retina home screen icon
Retina application launch image
Vector-only apps
iPad display
See also
Supporting multiple resolutions
Getting ready
How to do it...
Setting supported devices and resolutions
Displaying the correct bitmap
How it works...
There's more...
Default stage size
Model-View-Controller architecture
Dynamic sizing and layout
Supporting iPad separately
See also
Setting the default aspect ratio
Getting ready
How to do it...
How it works...
There's more...
Auto aspect ratio
See also
Enabling auto-orientation
Getting ready
How to do it...
How it works...
There's more...
Checking for orientation support
Programmatically setting auto-orientation
Stage scale mode
Stage alignment
See also
Listening for orientation changes
Getting ready
How to do it...
How it works...
There's more...
Determining device orientation
See also
Responding to orientation changes
Getting ready
How to do it...
How it works...
There's more...
The stage color
Stage orientation
Preventing auto-orientation
See also
9. Geolocation and Accelerometer APIs
Introduction
Determining your current location
Getting ready
How to do it...
How it works...
There's more...
Accuracy
Altitude support
Mapping your location
Calculating distance between geolocations
Geocoding
Gyroscope support
See also
Determining your speed and heading
Getting ready
How to do it...
How it works...
There's more...
Determining support
Simulating the GPS receiver
Preventing screen idle
See also
Checking for geolocation access
Getting ready
How to do it...
How it works...
See also
Responding to accelerometer changes
Getting ready
How to do it...
How it works...
There's more...
Orientation and the accelerometer axes
Determining device orientation
Applying a low-pass filter
Applying a high-pass filter
The "muted" property
See also
Detecting a shake
Getting ready
How to do it...
How it works...
There's more...
Checking multiple axes
Smoothing accelerometer data
See also
10. Camera and Microphone Support
Introduction
Saving to the camera roll
Getting ready
How to do it...
How it works...
There's more...
Handling a failed save
Saving specific display objects
Video and the camera roll
See also
Reading from the camera roll
Getting ready
How to do it...
How it works...
There's more...
Parsing Exif data
See also
Capturing with the default camera app
Getting ready
How to do it...
How it works...
There's more...
Handling errors
Displaying the captured image
Saving the captured image to the camera roll
Capturing video
Reading the captured data
See also
Working with the built-in cameras
Getting ready
How to do it...
How it works...
There's more...
Portrait mode
Selecting a camera
Grabbing a bitmap image
Live streaming
Using the stage
See also
Recording microphone audio
Getting ready
How to do it...
How it works...
There's more...
Microphone activity
Live streaming
See also
Playing recorded audio
Getting ready
How to do it...
How it works...
There's more...
Working with lower sample rates
Saving captured data
Exporting as WAV or MP3
See also
11. Rendering Web Pages
Introduction
Opening a web page within Safari
Getting ready
How to do it...
How it works...
See also
Rendering a web page within an app
Getting ready
How to do it...
How it works...
There's more...
Page load events
Multiple instances
Checking for support
Retina web pages within a standard screen resolution
Including banner ads
OAuth support
See also
Navigating the browsing history
Getting ready
How to do it...
How it works...
There's more...
Obtaining the current location
Stopping and reloading pages
Detecting when the URL is about to change
See also
Rendering a local web page
Getting ready
How to do it...
Bundling the HTML
Loading the bundled HTML
How it works...
There's more...
Bi-directional ActionScript/JavaScript communication
See also
Dynamically generating a local web page
Getting ready
How to do it...
Linking to the as3corelib API
Generating the HTML
How it works...
There's more...
Cleaning-up
Using loadString()
See also
Capturing a snapshot of a web page
Getting ready
How to do it...
How it works...
There's more...
Overlaying display objects
See also
12. Working with Video and Audio
Introduction
Playing local FLV video
Getting ready
How to do it...
Bundling the FLV video
Playing the FLV video
How it works...
There's more...
Metadata and cue point events
Playing remote FLV video
Screen lock
Maximizing playback performance
Bundling multiple videos
See also
Playing local H.264 video
Getting ready
How to do it...
Bundling the H.264 video
Playing the H.264 video
How it works...
There's more...
Metadata and cue point events
Playing video captured by the default camera
Determining the video's size
Playing remote H.264 video
Encoding H.264 video
Bundling multiple videos
See also
Controlling video
Getting ready
How to do it...
How it works...
There's more...
NetStream status
Closing the video stream
Embedding audio
How to do it...
How it works...
See also
Playing embedded audio
Getting ready
How to do it...
How it works...
There's more...
Playback position
Looping
See also
Streaming audio
Getting ready
How to do it...
Bundling the MP3 file
Playing the MP3 file
How it works...
There's more...
Increasing the buffer time
Monitoring load progress
Sound length
Sound metadata
Working with raw PCM sound data
Playing audio in the background
See also
Controlling audio playback
Getting ready
How to do it...
Bundling the MP3 file
Controlling playback
How it works...
There's more...
Volume and panning
Global sound
See also
13. Connectivity, Persistence, and URI Schemes
Introduction
Monitoring Internet connectivity
Getting ready
How to do it...
Linking the SWC file
Checking connectivity
How it works...
There's more...
Monitoring sockets
Polling interval
See also
Specifying a persistent Wi-Fi connection
Getting ready
How to do it...
How it works...
See also
Referencing an app's common directories
Getting ready
How to do it...
How it works...
There's more...
Creating directories
See also
Writing files
Getting ready
How to do it...
How it works...
There's more...
Working with data formats
Writing synchronously
Monitoring progress
Persistence
See also
Reading files
Getting ready
How to do it...
How it works...
There's more...
Working with data formats
Reading synchronously
Monitoring progress
Deleting files
Other file modes
See also
Launching system applications
Getting ready
How to do it...
How it works...
There's more...
Dialing a phone number
Sending SMS messages
Playing a YouTube video
URI schemes within HTML
See also
Launching the App Store
Getting ready
How to do it...
Obtaining the app's URL
Linking to the app from ActionScript
How it works...
See also
Launching the Maps application
Getting ready
How to do it...
How it works...
There's more...
Generating directions
Mapping your current location
See also
Declaring device capabilities
Getting ready
How to do it...
How it works...
There's more...
Dropped support for ARMv6 devices
See also
Index

Flash iOS Apps Cookbook

Flash iOS Apps Cookbook

Copyright © 2012 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: February 2012

Production Reference: 2250112

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-84969-138-3

www.packtpub.com

Cover Image by Charwak A (<[email protected] >)

Credits

Author

Christopher Caleb

Reviewers

Daniel Albu

JP Berrie

Simon Buckley

Mark Doherty

Richard England

Stuart McLeman

Brian Rinaldi

David Wagner

Acquisition Editor

Douglas Paterson

Lead Technical Editor

Dayan Hyames

Technical Editor

Kedar Bhat

Copy Editor

Neha Shetty

Project Coordinator

Alka Nayak

Proofreader

Mario Cecere

Indexer

Rekha Nair

Graphics

Valentina D'Silva

Manu Joseph

Production Coordinator

Arvindkumar Gupta

Cover Work

Arvindkumar Gupta

About the Author

Christopher Caleb has been developing rich interactive experiences with the Flash platform for almost a decade. He remembers a time when browsers didn't support images, and has witnessed technologies such as Flash help drive the web to where it is today. During that period he has been fortunate enough to have worked with a wide range of clients including the BBC, Activision, Samsung, and Aardman Animations on projects encompassing film, games, education, and children's entertainment.

He has a love for all things mobile and has been a proponent of Flash in this space since its emergence. He is also an active member of the Flash community, both through his personal blog and the various articles he contributes elsewhere. Whenever he finds a spare minute, Christopher likes to chip away at the many apps and experiments he has inspired to undertake.

Christopher is currently a lead Flash developer at WeeWorld—an avatar-based social network and virtual world for teens. He blogs at www.yeahbutisitflash.com and tweets as @chriscaleb.

Acknowledgement

This book would not have been possible without the help and support of so many individuals.

First and foremost, I'd like to thank the people at Packt Publishing; in particular, Steven Wilding for providing me with this wonderful and unexpected opportunity; Maitreya Bhakal for his guidance and encouragement; and Kedar Bhat for his assistance and endless patience.

I'm extremely lucky to have had such talented technical reviewers (Daniel Albu, JP Berrie, Simon Buckley, Mark Doherty, Richard England, Stuart McLeman, Brian Rinaldi, and David Wagner) who, despite their workloads, managed to find the time to provide invaluable feedback. Dave and JP: I really owe you both for your perseverance over the last few weeks.

Various individuals at Adobe have also helped me along the way. Particularly, I'd like to thank Mark Doherty and Brian Rinaldi for their immense contribution and enthusiasm towards the project. I'd also like to extend thanks to Robert Christensen for always taking the time to answer my questions over the past twelve months.

A huge debt of gratitude is also owed to my brother Alan (alancaleb.com), Steve Koren (popjunk.co.uk), and Selina Wagner (blobina.com) whose creative talents grace the many code examples found within these pages. Also, a mention must go out to Matt McKenna (maketh.com) and Andrew Nicolson (drewnotweird.co.uk) for the part they both played.

I would also like to thank Graham MacDonald for affording me the time to write and, at the same time, earn a living; Helen and my little nephew Freddy (I love him even more than Flash) for making me smile; Gregory for providing the arm wrestling training that helped develop my typing stamina; and Amanda who makes every day better than the last. Special thanks must also be extended to Bobby Farmer who has always made time for me over the years and has been a constant source of encouragement.

Finally, to my father, mother, brother, and sister, I cannot thank you enough for your love and support, without which I am nothing.

About the Reviewers

Daniel Albu is a freelance Flash platform developer with more than ten years of experience in the production and deployment of rich media websites, games, and applications.

Daniel has unique expertise in production and integration of Flash and Flash platform-based technologies. Most recently, Daniel entered the mobile development field by using Adobe AIR to develop for the Android and iOS platforms.

Daniel also provides worldwide remote training and consultancy around Flash platform technologies for companies and individuals alike.

JP Berrie first encountered Macromedia Director 4 in 1995 while at university studying Multimedia Technology, and subsequently embarked upon a career as a Multimedia Developer, specializing in Director Lingo and latterly Flash ActionScript 3.0 programming.

He was appointed lead programmer for several BBC games titles, including Walking with Beasts, Bill & Ben the Flowerpot Men, and Rotten Ralph. Other titles include the Chicken Run game for Activision / Aardman Animations, and a title for interactive publishing giants Dorling Kindersley.

Since 2002, JP has freelanced for many clients including global brands such as AstraZeneca, BP, Diageo, Guinness, Kellogg's, Pepsi, Pfizer, and the Post Office.

Website: www.jpberrie.com.

Simon Buckley received his M.Sc in Physics from the University of Birmingham, England, in 2007 before moving into Computer Science to gain a M.Sc in Intelligent Systems Engineering at the same university in 2008.

After graduating, Simon spent some time as an enterprise Java developer before opting to go freelance. He is now a Flex Adobe Certified expert and his company, Techjump, specializes in developing workflow tools and Rich Internet Applications for desktop and mobile platforms. He loves working with new technologies, developing rich user experiences, and solving tough programming problems.

Mark Doherty is the Platform Evangelist for Mobile and Devices at Adobe, working to create a vibrant ecosystem around Flash Player and Adobe AIR for devices. He has spent ten years in the mobile and devices industry, including seven at Adobe, holding Engineering, Consulting, Business Development, and Marketing roles. Prior to this, Mark has worked with leading OEMs at Mobile Innovation, Nokia, Samsung, and Panasonic.

Richard England is an award winning freelance developer, who has worked with Flash technology for over 10 years, including building BAFTA-nominated educational games, interactive learning resources, and truly Rich Internet Applications.

An eternal student of all things digital, Richard is enthused by the ever-evolving mobile development landscape, creating applications for iOS both natively in Objective-C and with Adobe AIR.

Richard can be contacted through Twitter—@englandrp.

Stuart McLeman has been involved with web and mobile software development for ten years since his previous life in electronic engineering. From working on educational Flash content for the BBC through to his current role as lead iOS developer at WeeWorld, he has always been passionate about aesthetics and usability as well as good code. Although Objective-C is his new love, he still has fond memories of AS3. He can't wait to see how the mobile landscape will evolve so he can decide what to learn next!

Stuart can be contacted through his website: www.stuartmcleman.com where he promises to someday start a blog, or through Twitter—@stuartmcleman.

Brian Rinaldi is a content and community manager for the Adobe Developer Center team, where he oversees community strategy for developers with a focus on HTML5 and JavaScript. Brian has been a Flex, Flash, and ColdFusion developer for over a dozen years and has been always known for his contributions to the community as an open source developer, a speaker, and an author. Brian founded the ColdFusion user group in Boston as well as the RIA Unleashed conference. Brian blogs regularly at http://remotesynthesis.com and is an unreformed twitter addict—@remotesynth.

David Wagner has been creating mobile phone games and applications for over a decade—from the days when 96x64 pixel displays with four shades of green were a luxury, through to the present with multi-cored, GPU-accelerated devices of pure awesomeness. In between, he has played with assembler, made a career of embedded C programming, decided browsers were more fun with ActionScript, and then went back to the future with Objective-C. He is currently a senior engineer at HuzuTech, working on a cross-platform virtual world framework.

If you want to read his occasionally coherent ravings, visit www.noiseandheat.com, or you can follow his stream of sarcasm on Twitter—@kaeladan.

www.PacktPub.com

Support files, eBooks, discount offers, and more

You might want to visit www.PacktPub.com for support files and downloads related to your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read, and search across Packt's entire library of books.

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

Preface

The iPhone is revolutionary. Every day, it seems, someone finds an innovative use for it and, in the App Store, the perfect outlet for their work. Its success has made apps cool and helped shift delivery of content away from the browser. Adobe has reacted to this change by repositioning the Flash platform, and providing the tools required for the creation and publication of native iOS applications directly from Flash Professional.

The Flash iOS Apps Cookbook is a culmination of my experience working with AIR for iOS since its beginnings. I have paid particular attention to the fundamentals, focusing on the groundwork that many newcomers find daunting. For those with a firm grasp of the basics, there is plenty to learn, from working with the device's many sensors, to maximizing the performance of graphics using hardware acceleration.

By the end of this book, you will have acquired the necessary skills to write and distribute your own native iOS applications using Flash. I hope that you will use what you have learned here to create beautiful applications that befit the talented and inspiring community you are about to become a part of.

What this book covers

Chapter 1, Getting Started with iOS App Development, leads you through the often intimidating process of becoming a registered iOS developer. By the end of the chapter you will have the necessary files required to publish native iOS apps from Flash Professional.

Chapter 2, Building iOS Apps Using Flash, covers everything required to configure Flash Professional and publish native iOS apps from it. You will also learn how to install apps on an iPhone for testing.

Chapter 3, Writing your First App, takes you through the steps necessary to build and test your very first iOS app using Flash Professional with a modest amount of ActionScript. Some best practices for development will also be explored.

Chapter 4, Porting Flash Projects to iOS, will get you started on the right foot when converting Flash projects from the desktop to iOS. You will learn how to work within mobile constraints and how to avoid common pitfalls that can often cripple an app's performance.

Chapter 5, Multi-touch and Gesture Support, will show you how to take full advantage of the touch-screen. You will learn how to detect multiple touch points and respond to swipe, pan, and pinch gestures with ActionScript.

Chapter 6, Graphics and Hardware Acceleration, provides invaluable recipes for an area that often causes frustration. We will cover powerful techniques for dramatically boosting your application's frame rate and learn the intricacies of Flash's rendering pipeline. With this knowledge, you will be able to push the graphics performance of your own creations to the limit!

Chapter 7, Working with Text and the Virtual Keyboard, will help you adjust to life without physical keys by exploring support for iOS's virtual keyboard and native text-input controls. Time will also be spent covering relevant features of Flash's own text engine.

Chapter 8, Screen Resolution and Orientation Changes, details how to render content on any iOS device regardless of its screen resolution or physical orientation. Support for the high resolution Retina display can also be found, along with instructions detailing how to set up a universal app that can target iPhone, iPad, and iPod touch.

Chapter 9, Geolocation and Accelerometer APIs, covers recipes that utilize both the device's GPS sensor and its accelerometer. Learn how to make location-aware apps, respond to changes in physical orientation and detect vibration.

Chapter 10, Camera and Microphone Support, will help you master two of the most popular sensors built into iOS devices. With the camera, you will learn how to shoot video, capture photos, and access the image library. This chapter will conclude by covering how to record and play back audio captured with the microphone.

Chapter 11, Rendering Web Pages, focuses on the presentation of web content—both directly within your app and by launching Safari. It also covers how to dynamically generate HTML, navigate the browsing history, and capture a snapshot of the current page.

Chapter 12, Working with Video and Audio, explores the many A/V options available when targeting iOS. In addition to utilizing Flash's popular FLV video format, this chapter will detail how to take advantage of hardware-accelerated H.264 video for best quality high-definition playback.

Chapter 13, Connectivity, Persistence, and URI Schemes, ties up some loose ends, beginning with Internet connectivity. Next, file system access is discussed—a topic touched upon by a number of recipes throughout the book. At the end of the chapter, space is given over to the use of URI schemes to launch various system apps including Mail, YouTube, App Store, and Maps.

Chapter 14, Using Native Extensions and ADT, details how to use the command line to take advantage of AIR for iOS features that aren't currently provided from Flash Professional directly. Specifically, you will learn how to use native extensions to access iOS-specific APIs missing from the AIR SDK. This chapter is not present in the book but is available as a free download at the following link: http://www.packtpub.com/sites/default/files/downloads/1383_Chapter14.pdf

Chapter 15, ActionScript Optimization, covers a range of invaluable optimizations that can be applied to your project's ActionScript. You will see how even the simplest of changes can improve your application's execution speed or improve its memory usage. This chapter is not present in the book but is available as a free download at the following link: http://www.packtpub.com/sites/default/files/downloads/1383_Chapter15.pdf

Appendix A, Flash Professional CS5.5 Specific Recipes, contains a list of the recipes throughout this book that require Flash Professional CS5.5 and AIR 2.6 or above. The appendix is not present in the book but is available as a free download at the following link: http://www.packtpub.com/sites/default/files/downloads/1383_AppendixA.pdf

Appendix B, ActionScript Optimization Measurements, provides the results from various optimizations detailed in Chapter 15. This appendix is not present in the book but is available as a free download at the following link: http://www.packtpub.com/sites/default/files/downloads/1383_AppendixB.pdf

What you need for this book

This book has been written for users of Adobe Flash Professional CS5 or CS5.5.

The majority of recipes covered are compatible with both CS5 and CS5.5. However, some are specific to CS5.5 and require the latest version of the Adobe AIR SDK.

You will also need an iPhone, iPad, or iPod touch. Flash Professional CS5.5 supports the development of applications for iOS 4 or above, whereas CS5 also provides support for older devices running iOS 3.

You can build native iOS apps using either Flash Professional for Mac OS X or Microsoft Windows.

Who this book is for

The material throughout this book is written for both beginners and seasoned developers with a working knowledge of ActionScript 3.0 and Flash Professional. If you ever want to leverage your existing Flash skills to write iOS apps, then this book will show you how, starting with the basics. Those users who are already up to speed can go directly to the more advanced topics that are on offer.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.1

Chapter 1. Getting Started with iOS App Development

In this chapter, we will cover:

Joining the iOS Developer ProgramAccessing the iOS Provisioning PortalGenerating a Certificate Signing Request using WindowsGenerating a Certificate Signing Request using Mac OS XObtaining your development certificateCreating a P12 certificate using WindowsCreating a P12 certificate using Mac OS XRegistering a deviceCreating an App IDCreating a development provisioning profileInstalling a provisioning profile on your device

Introduction

When writing iOS applications, the creation and management of certain files is necessary in order to test on a real device. The exact files required depends on whether you are currently developing or preparing for distribution. We will focus primarily on development.

By the end of this chapter, you will have created a P12 certificate file and a development provisioning profile, both of which are required if you want to make full use of the recipes throughout this book. Along the way, you will learn the ins and outs of various tools including Apple's iOS Provisioning Portal, which you will come to use extensively during your time as an iOS developer.

Don't worry if it doesn't all make perfect sense at first. If you follow the steps detailed in each recipe, you will end up with the development files required to work through the rest of the book.

Joining the iOS Developer Program

Registering as an Apple developer and enrolling in one of the iOS Developer Programs are prerequisites for anyone wishing to write iOS apps.

Although you can enroll in a free program, if you want to install your applications on devices and distribute them in the App Store, you will need to pay a $99 annual fee to join the standard program.

Those developing with the iOS SDK can select the free program and test their apps using the iOS simulator, which is provided with Apple's official development tools. Unfortunately, native iOS apps built withFlash Professional do not run on the simulator. Therefore, if you want to fully test the examples provided in this book, you will need to install them on an iOS device.

Note

Within Flash Professional, you can use the AIR Debug Launcher (ADL) to test your applications on the desktop; however, no iOS device capabilities are supported thus restricting ADL's usefulness.

Let us take a look at the steps required to enroll.

Getting ready

Enrollment takes place on the Apple Developer website. If you aren't using Apple's Safari browser, then it is recommended that you download and install it, as problems are reported from time to time when trying to use certain areas of the site on other browsers.

Safari is the default web browser preinstalled on Mac OS X. Those using Windows, who don't already have Safari, can download it from www.apple.com/safari/download.

If you already have Safari installed, then make sure that you have the most recent version.

Tip

There are several paths you can take during the enrollment process and once you have completed it, it may not be possible to change some of your choices. Think carefully before submitting your enrollment details and purchasing your Developer Program. You may want to first read through this recipe in its entirety to ensure that you are fully aware of all the options available to you.

How to do it...

Visit the Apple developer website at http://developer.apple.com. Scroll down the page until you see the Join the iOS Developer Program link as shown in the following screenshot:

Tip

Be aware that Apple regularly makes alterations to its various developer websites. Therefore, the location of items shown within this chapter's screenshots may differ slightly by the time you read this. The links described throughout the chapter may be subject to change too.

Click on the link. You will be taken to the iOS Developer Program page where you will find an Enroll Now button at the top of the page.Click on the Enroll Now button to move to the Enroll in the Apple Developer Programs page. The three main steps required for enrollment are listed on this page. They are:
Register as an Apple DeveloperSelect Your ProgramsComplete Your Purchase
At the bottom of the page is a Continue button, which will begin the process of taking you through each of these steps. Go ahead and click on it.

Note

Next to the Continue button you will find text outlining the technical requirements for enrollment. This refers to developers using Apple's iOS SDK and does not apply to those using Flash Professional. Ignore it.

Register as an Apple developer

From the Are you new or a registered Apple developer? page, you will be able to register as a new Apple developer. Within the New Apple Developer column, click on the I need to create a new account and Apple ID for an Apple Developer Program radio button as shown in the following screenshot:

Note

If you currently have an Apple ID, then click on the second radio button within the column. If you are an existing Apple developer, then you should select the appropriate radio button from the Existing Apple Developer column instead.

Click on the Continue button to move to the Are you Enrolling as an Individual or Company? page.

Two options are provided. Enroll as an individual or enroll on behalf of a company.

Note

To enroll as a company, you will need to provide Apple with business documents and have the legal authority to bind your company to the legal agreements presented to you during enrollment.

Depending on your needs, click on either the Individual or the Company button at the bottom of the page.Now complete your personal profile by performing the following tasks:
Specify a desired Apple ID and password.Set up some security information that can be used to verify your identity.Submit your personal information.

Note

When submitting your contact information, the name you specify will appear as the "seller" for any apps you distribute on the App Store.

Do not attempt to add an alias or organization name within the name fields. This will most likely result in failure of your Apple Developer registration or suspension of your account when the error is eventually noticed by Apple.

If you want to have a company name to appear as the "seller", then enroll as a company and provide Apple with the relevant legal documentation to verify your identity.

If you are registering as an individual, then enter your first and last name into the Company/Organization field.

Read the information provided on the displayed page carefully and once you have completed the form, click on the Continue button which will take you to the Complete your professional profile page.For the Which Apple platforms do you develop with? field, check on the iOS checkbox. This will reveal a list of additional fields that must be populated.When you come to the Please select the primary category for your application(s) field, ensure that you click on the Commercial Applications radio button.

Note

By selecting to develop commercial applications, you will have to provide your banking details before you can distribute your apps; however, you won't be asked for this information as part of the enrollment process. If you plan only to distribute free apps, then you can select the Free Applications radio button and no banking details will be required. This option will suffice for the examples within this book; however, if you plan to sell apps at some point, then stick with the Commercial Applications option.

Once you have provided answers for all the fields in the form, click on the Continue button at the bottom of the page.Carefully read the Registered Apple Developer Agreement that is displayed. Acknowledge that you have read it by checking on the checkbox and then clicking on the I Agree button at the bottom of the page.A verification code will be sent to your e-mail address. Retrieve the code and enter it into the text field provided on the Enter the verification code sent to your email page. Click on Continue.

A second e-mail will be sent confirming that you are now a registered Apple developer.

Note

The e-mail will also contain the Apple ID you chose. Keep this e-mail safe as you will need your Apple ID (along with your password) to access certain resources on the Apple Developer website.

Select your program

Within your web browser you will be taken to the Enter your billing information for identity verification page.

Enter your first and last name exactly as they appear on your credit card. Also provide your credit card billing address.Click on the Continue button at the bottom of the page.

Note

At this point your credit card details will be used for identity verification. You will not be asked for your credit card number and won't be charged.

The Select Your Program page will appear. As shown in the following screenshot, check on the iOS Developer Program checkbox and click on Continue at the bottom of the page:The next page will let you review your enrollment information. Verify that you have selected the iOS Developer Program and that your personal details and billing information are correct. If any of the information is incorrect, click on the Go Back button at the bottom of the page and make any necessary alterations.Click on Continue to submit your enrollment information to Apple.The Program License Agreement page will appear. Acknowledge that you have read it by checking on the checkbox, then click on the I Agree button at the bottom of the page.

Complete your purchase

A purchase page will appear. Click on Add to cart to proceed to your country's online store in order to purchase your program.A new browser window will open and you will be taken to the Apple Store. Confirm that your iOS Developer Program is in your basket and click on the Checkout Now button on the right side of the page to purchase the item.An activation e-mail will be sent to you within 24 hours. When you receive it, follow the instructions to activate your iOS Developer Program.

How it works...

Registering as an Apple developer and activating your Developer Program enables you to access the iOS Provisioning Portal through Apple's iOS Dev Center website. The iOS Provisioning Portal takes you through the necessary steps to test and distribute your apps on iOS devices, and will be used throughout this chapter.

You will use the Apple ID and password that you set up to log into the iOS Dev Center at http://developer.apple.com/devcenter/ios.

There's more...

The following additional pieces of information are worth considering.

Working with multiple team members

If you opt to enroll as a company, then you can add additional team members to your account who can access iOS Developer Program resources. This will allow, for example, other team members to generate and download the developer files required to build and deploy apps to an iOS device.

If you enroll as an individual, then you will be the sole developer who has access to the program resources. It will be your responsibility to generate all required developer files and manage the list of test devices.

iOS SDK, tools, and documentation

The iOS Dev Center contains a wealth of resources. While the documentation and tools available are aimed at developers using the iOS SDK, you will find some that will be of use when building your own apps with Flash Professional.

An important document to start with is the iOS Human Interface Guidelines at http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG. It describes the guidelines and principles that help you create apps that feel as though they were designed specifically for iOS.

Also, if you are planning to release your apps on the App Store, then read the App Store Review Guidelines at http://developer.apple.com/appstore/guidelines.html.

If you are developing on Mac OS X you may also want to download the developer toolset. While this book will not cover Apple's developer tools, spend some time exploring the Instruments application, which comes as part of the bundle, and provides powerful profiling and debugging features that can help you fine tune your apps.

A good place to start is the Introduction to Instruments User Guide at http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Introduction.

Accessing the iOS Provisioning Portal

The iOS Provisioning Portal is an online tool designed to take you through the steps required to test your apps on iOS devices and prepare them for distribution on the App Store.

This is where you will create and download the developer files that are required to build your apps with Flash Professional.

Let us go through the steps required to access it.

Getting ready

You will need an Apple ID to enroll on the iOS Developer Program.

If you haven't already done so, follow the steps detailed in the Joining the iOS Developer Program recipe.

How to do it...

Visit the iOS Dev Center website at http://developer.apple.com/devcenter/ios. Click on the Log in button at the top of the page.On the Sign in with your Apple ID page, enter your Apple ID and password into the text fields. Click on the Sign in button.If successful, you will be taken back to the iOS Dev Center home page where you will now have access to the main areas of your Developer Program including the iOS Provisioning Portal. Links to these can be found near the top-right of the home page underneath the iOS Developer Program heading.Click on the iOS Provisioning Portal link to access the portal's home page, which is shown in the following screenshot:

How it works...

The Provisioning Portal provides you with the resources to develop and distribute your iOS apps.

For the examples in this book, you only need to concern yourself with development. The following are the four main steps required to do this:

Obtain a development certificateRegister iOS devices for testingCreate unique IDs for your appsCreate and download development provisioning profiles

These steps can be performed from the links on the left-hand side of the Provisioning Portal page and are broken down and covered throughout the remainder of this chapter.

Alternatively, Apple has provided the Development Provisioning Assistant, which can be used to guide you through the process. However, the Provisioning Assistant is not covered in this book.

There's more...

You are encouraged to spend time exploring the Provisioning Portal as it is integral to the iOS development process.

The following information may also be of some use.

Resources

On the right-hand side of the portal's home page is the Resources section where you can find links to guides, "how to" videos, documentation, and user forums.

The "how to" videos are ideal if you need further clarification regarding the provisioning steps. At the head of the Resources section you will also find a link to the Program User Guide, which covers the provisioning process in detail.

Remember that all content on the site will be aimed at Mac OS X owners. If you are using Windows, then some of the content may not be applicable.

Adding team members

If you enrolled on behalf of a company, then you will also be able to add other team members to your account.

As the original enrollee, you have access to all iOS Provisioning Portal capabilities and can assign roles for any members you invite. The role you assign to an individual determines the privileges they get and dictates the tasks they can undertake.

Team management is handled within the Member Center, which you can access from the Provisioning Portal's home page. Simply click on the Visit the Member Center now link on the center of the portal's home page.

Those who have signed-up as an individual will not be able to add team members but will have access to all Provisioning Portal capabilities.

For a comprehensive guide to team administration, take a look at the Program User Guide within the Resources section.

Distribution

The steps required for preparing your apps for App Store submission and distribution are not covered within this book. However, once you are comfortable with the provisioning process for application development, you will find that distribution isn't too dissimilar.

Comprehensive documentation regarding distribution is available from the Program User Guide in the Provisioning Portal's Resources section.

Technical support

As a member of the iOS Developer Program, you are entitled to support from the Apple Developer Technical Supportteam, where you can receive direct one-to-one help from a qualified Apple engineer.

Included with your Developer Program membership is free technical support for two incidents during your membership period.

However, you should be aware that this support is primarily for developers using the iOS SDK. Apple engineers will not be able to help with questions regarding Flash Professional.

Generating a Certificate Signing Request using Windows

A Development Certificate is used to identify a developer for the purpose of installing and testing apps on iOS devices. Without one you can't publish native iOS apps from Flash Professional. You obtain a development certificate from Apple's iOS Provisioning Portal but to do that you must first generate a Certificate Signing Request (CSR)file.

The process for generating a CSR differs depending on your choice of operating system.

The steps for Microsoft Windows are covered here. If you are using Mac OS X, then refer to the Generating a Certificate Signing Request using Mac OS X recipe.

Getting ready

CSR files are generated using OpenSSL, which can be downloaded and installed from www.slproweb.com/products/Win32OpenSSL.html. You will actually need to install two files from the site.First scroll down to the Download Win32 OpenSSL section and download the Visual C++ 2008 Redistributables installer. Simply run the executable and follow the wizard through the installation process.Next, download and run the Win32 OpenSSL v1.0.0e Light installer. The wizard will ask you to select where OpenSSL should be installed. Keep the default location set to C:\OpenSSL-Win32. Additionally, when prompted, instruct the installer to copy OpenSSL's DLLs to The Windows system directory.

How to do it...

Open a command prompt window using administrator privileges.

Note

How you run a command session with administrator privileges depends on your choice of operating system.

If you are a Windows 7 or Vista user, then click on the Start button and type cmd into the search box. However, rather than simply pressing Enter, you should press Ctrl + Shift + Enter. A dialog will appear asking if you want to allow the program to make changes to your computer. Click on the Yes button.

If you are using Windows XP, then ensure you are logged on with an administrator account. Click on the Windows Start button and then select Run. From the Run dialog box, type cmd and press Enter.

From the command prompt move to OpenSSL's bin folder by entering the following command:
cd C:\OpenSSL-Win32\bin
Now create a private key by entering:
set RANDFILE=.rnd

followed by:

openssl genrsa -out mykey.key 2048
The file, mykey.key, will be output to OpenSSL's bin folder.

Note

OpenSSL may still output a file after reporting an error on the command line. If you find an error, check your syntax and run the command again as it's unlikely your file will be usable.

Using your private key you can now create the CSR file. To do this, a command with the following format is required:
openssl req -new -key mykey.key -out CertificateSigningRequest.certSigningRequest -subj "/[email protected], CN=John Doe, C=US"

You will need to make some changes when typing the preceding command into the command line. Replace the e-mail address and certificate name with the same e-mail address and name you enrolled within the iOS Developer Program. Also, if you live outside the United States, you will need to edit the country code.

Note

A list of country codes that can be used when creating a CSR can be found on the DigiCert website at www.digicert.com/ssl-certificate-country-codes.htm.

A CSR file named, CertificateSigningRequest.certSigningRequest will be created and output to the bin folder.

How it works...

You now have a CSR file that contains your personal information (your name, e-mail address, and country) and will be used to request a development certificate from Apple.

When the CSR file was created, OpenSSL also created a public and private key. The public key is included within the CSR file while the private key is used to sign the request.

Don't delete your CSR file or the private key as they will both be required later in this chapter.

See also

Obtaining your development certificate

Generating a Certificate Signing Request using Mac OS X

A development certificate is used to identify a developer for the purpose of installing and testing apps on iOS devices. Without one you can't publish native iOS apps from Flash Professional. You obtain a development certificate from Apple's iOS Provisioning Portal but to do that you must first generate a Certificate Signing Request (CSR) file.

The process for generating a CSR differs depending on your choice of operating system.

The steps for Mac OS X are covered here. If you are using Microsoft Windows then refer to the Generating a Certificate Signing Request using Windows recipe.

How to do it...

Follow the steps to generate a CSR:

Launch the Keychain Access application from the Applications/Utilities folder.Once opened, select Preferences from the Keychain Access (Cmd + ,) menu.From the Preferences dialog box, click on the Certificates tab and ensure that both Online Certificate Status Protocol (OCSP) and Certificate Revocation List (CRL) are set to Off. Close the dialog box.On the Keychain Access menu select Certificate Assistant | Request a Certificate from a Certificate Authority.The Certificate Assistant dialog box will appear where you can enter your personal information. In the text fields provided, enter the e-mail address and name you enrolled within the iOS Developer Program. Leave the CA Email Address field blank and click on the Save to disk radio button. Now click on Continue.When asked, select to save the certificate to your desktop.

A CSR file named CertificateSigningRequest.certSigningRequest will be created and saved on disk.

How it works...