Richard
Wagner
WILEY
INTRODUCTION xv
CHAPTER 1: INTRODUCING FLASH DEVELOPMENT
FOR MOBILE DEVICES 3
Expanding
to the Mobile World 3Discovering
Adobe AIR5
Building
for Android 5Building
foriOS 6What You Can and Cannot Do
7
Device
Support
7Unsupported
AS3 APIObjects
8Understanding
the AIR for AndroidSecurity
Model 9Getting
toKnow the Android SDK
10Getting
to Know the iOS SDK 11Summary
11CHAPTER 2: SETTING UP YOUR DEVELOPMENT ENVIRONMENT 13
Preparing
for AndroidDevelopment
13
Installing
the AIR SDK 13Creating
aCode-Signing
Certificate 15Installing
the Flash CS5Extension for AIR 2.5 17Installing
theAndroid SDK 17Adding
the AndroidSDK toYourSystem
Path 19Creating
anAndroid Virtual Device 21Installing
the AIR RuntimeontoYour Device 22Comparing
theDevelopment
EnvironmentOptions
22Using
MXML in AndroidApps
23Preparing
for iOSDevelopment
23Joining
the iPhoneDeveloper Program
23Getting
an iPhoneDeveloper
Certificate 24Retrieving
theDeveloper
Certificate 28Adding
a Device 30Creating
aProvisioning
Profile 32Installing
theProvisioning
Profile 35Summary
37CHAPTER 3: BUILDING AND INSTALLING VANILLAAPP 39
VanillaApp
for Android 39Creating
aProject
40Creating
a Flash DocumentforAIRforAndroid 40Creating
anActionScript
Document Class 41Coding
the Document Class 43Adding
Icons 49Defining
AndroidSettings
49Previewing
theApp
insideFlash 52Publishing
andInstalling
theApplication
53Running
theApp
onanAndroid Device 53VanillaApp
for iOS 54Creating
aProject
56Creating
an iPhone-Based Flash Document 57Creating
anActionScript
Document Class 57Coding
the Document Class 58Creating
aSplash
Screen 65Adding
Icons 66Defining
iPhoneSettings
66Previewing
theApp
inside Flash 70Publishing
theApplication
70Installing
theApp
on an iPhone 71Summary
73CHAPTER 4: RETHINKING ACTIONSCRIPT PROGRAMMING 77
Conserving
Memory
and CPU Resources 77ActionScript
Practices78
Reuse
Objects
78General
Tips
forWorking
with AS3 79Event
Handling
81Ul Practices 81
Graphics
Practices 82Caching
82Miscellaneous
Tips
83General
Application
Practices 83Frame Rate 83
GPU
Rendering
84Garbage
Collection 84Kitchen Sink
Tips
85Summary
85CHAPTER 5: MULTITOUCH API 87
Understanding
the MultitouchJargon
87Mouse Emulation Events 87
Touch Events 88
Gesture Events 88
Listening
forTouch Events 89Event
Bubbling
89Working
with Touch Events 89Coding
the Document Class 90Running
theApp
92Working
with theSwipe
Gesture 96Setting Up
the Timeline 96Adding
a Sound Asset 96Coding
the Document Class 97Running
theApp
101Working
with Rotate and Zoom Gestures 101Coding
the Document Class 102Running
theApp
106Summary
107CHAPTER 6: DETECTING MOTION WITH ACCELEROMETER 109
Introducing
Accelerometer andAccelerometerEvent
110
Listening
for Accelerometer Events 111Coding
the Document Class 111Running
theApp
114Responding
to Accelerometer Events114
Creating
theSphere
Class 115Coding
the Document Class 116Running
theApp
121Detecting Shaking
122
Coding
the Document Class 122Running
theApp
127Summary
127CHAPTER 7: IMPLEMENTING AUTO ORIENTATION 129
Enabling
YourApp
to Rotate129
StageOrientationEvent
130Two Essentials for Ul Reorientation 131
Detecting
anOrientation
Change
132
Changing
Positioning
Based on OrientationChanges
138Summary
144CHAPTER 8: GEOLOCATION API 145
Getting
Geolocation Data 145Enabling
GPS
Support
for Android 147Creating
a Basic GeolocationApplication
148Coding
the Document Class 148Testing
andRunning
theApp
152Creating
aCompass App
153Coding
the Document Class 153Running
theApp
159Creating
aSpeedometer
and Altimeter 160Embedding
a Fontin YourApp
160Coding
the Document Class 161Configuring Landscape
Orientation 167Running
theApp
169Sending
Geolocation toa Web Service 169Coding
the Document Class 170Running
theApp
178Summary
178CHAPTER 9: SERVICE INTEGRATION USING URL PROTOCOLS 179
Abstracting
URLProtocols
180Making
Phone Calls from YourApplication
181Creating
PhoneDialer.as 181Using
PhoneDialerinanApp
182Sending
SMSMessages
187Creating
SMS.as 188Adding
SMSSupport
to PhoneServicesApp
189Running
the App 189Sending
E-mails 191Creating
Mail.as 191Sending
Mail from anApp
194Android:
Adding
Permissions 196Pointing
onGoogle Maps
198Creating
GoogleMaps.as
199Using GoogleMaps
in anApp
200Android:
Setting
Permissions 206Running
theApp
206Summary
207
CHAPTER 10: ANDROID
CAMERA,
CAMERAROLL,
AND MICROPHONE 209
CameraUl:
Launch and
Return210
Camera:
Creating
a Live Video Feed 216Tapping
intothe Camera Roll
221Capturing
Sounds with theMicrophone
228Summary
234CHAPTER 11: FILE MANAGEMENT 237
Understanding
the Android File
andDirectory
Structure
237
Working
withDirectories, Files,
and File Streams 238Working
with Directories 238File
System Operations
241Reading
andWriting
Files 244Reading
a File 245Writing
toa File 246Android Case
Study:
Jots 246Coding
the DocumentClass 248Running
Jots 253Summary
253CHAPTER 12: LOCAL DATABASES 255
Working
withaSQLite
Database 255Open
a Database Connection 256Creating
aSynchronous
Connection 256Creating
anAsynchronous
Connection 256Creating
Tables257
Making
a SQLQuery
262Inserting
andUpdating
Records 263Summary
269PART IV:TESTING AND DEBUGGING
CHAPTER13: REMOTE DEBUGGING 273
Establishing
aWIFI Connection 273Using
the AIRDebug
Launcher 274Android
Debugging
274Remote
Debugging
inside the Flash IDE 274Remote
Debugging
fromthe Command Line 276Debugging
with Android SDK'sLogcat
277iOS
Debugging
277Remote
Debugging
inside the Flash IDE 277Viewing
GPURendering
Diagnostics
278Summary
278CHAPTER14: SUBMITTING YOUR APP TO THE APP STORE 279
Preparing
Your AndroidApp
279Getting
a Screenshot 280Submitting
YourApp
tothe AndroidMarket
281
Registering
YourDeveloper
Profile 281Submitting
YourApp
282Preparing
Your iOSApp
285Getting
a Distribution Certificate 285Creating
aDistributionProvisioning
Profile 287Publishing
a Distribution Release of YourApp
288Submitting
YourApp
to theApple App
Store 288Summary
289APPENDIX A: APPLICATION DESCRIPTOR SETTINGS 291
APPENDIX B: COMPILING APPLICATIONS
FROM THE COMMAND LINE 305
INDEX 309