Professional Flash Mobile Development: Creating Android and iPhone Applications
Buy Rights Online Buy Rights

Rights Contact Login For More Details

More About This Title Professional Flash Mobile Development: Creating Android and iPhone Applications

English

INTRODUCTION xv

PART I: GETTING STARTED

CHAPTER 1: INTRODUCING FLASH DEVELOPMENT FOR MOBILE DEVICES 3

Expanding to the Mobile World 3

Discovering Adobe AIR 5

Building for Android 5

Building for iOS 6

What You Can and Cannot Do 7

Device Support 7

Unsupported AS3 API Objects 8

Understanding the AIR for Android Security Model 9

Getting to Know the Android SDK 10

Getting to Know the iOS SDK 11

Summary 11

CHAPTER 2: SETTING UP YOUR DEVELOPMENT ENVIRONMENT 13

Preparing for Android Development 13

Installing the AIR SDK 13

Creating a Code-Signing Certificate 15

Installing the Flash CS5 Extension for AIR 2.5 17

Installing the Android SDK 17

Adding the Android SDK to Your System Path 19

Creating an Android Virtual Device 21

Installing the AIR Runtime onto Your Device 22

Comparing the Development Environment Options 22

Using MXML in Android Apps 23

Preparing for iOS Development 23

Joining the iPhone Developer Program 23

Getting an iPhone Developer Certificate 24

Retrieving the Developer Certificate 28

Adding a Device 30

Creating an App ID 31

Creating a Provisioning Profile 32

Installing the Provisioning Profile 35

Summary 37

CHAPTER 3: BUILDING AND INSTALLING VANILLAAPP 39

VanillaApp for Android 39

Creating a Project 40

Creating a Flash Document for AIR for Android 40

Creating an ActionScript Document Class 41

Coding the Document Class 43

Adding Icons 49

Defining Android Settings 49

Previewing the App inside Flash 52

Publishing and Installing the Application 53

Running the App on an Android Device 53

VanillaApp for iOS 54

Creating a Project 56

Creating an iPhone-Based Flash Document 57

Creating an ActionScript Document Class 57

Coding the Document Class 58

Creating a Splash Screen 65

Adding Icons 66

Defining iPhone Settings 66

Previewing the App inside Flash 70

Publishing the Application 70

Installing the App on an iPhone 71

Summary 73

CHAPTER 4: RETHINKING ACTIONSCRIPT PROGRAMMING 77

Conserving Memory and CPU Resources 77

ActionScript Practices 78

Reuse Objects 78

General Tips for Working with AS3 79

Event Handling 81

UI Practices 81

Graphics Practices 82

Caching 82

Miscellaneous Tips 83

General Application Practices 83

Frame Rate 83

GPU Rendering 84

Garbage Collection 84

Kitchen Sink Tips 85

Summary 85

CHAPTER 5: MULTITOUCH API 87

Understanding the Multitouch Jargon 87

Mouse Emulation Events 87

Touch Events 88

Gesture Events 88

Listening for Touch Events 89

Event Bubbling 89

Working with Touch Events 89

Coding the Document Class 90

Running the App 92

Working with the Swipe Gesture 96

Setting Up the Timeline 96

Adding a Sound Asset 96

Coding the Document Class 97

Running the App 101

Working with Rotate and Zoom Gestures 101

Coding the Document Class 102

Running the App 106

Summary 107

CHAPTER 6: DETECTING MOTION WITH ACCELEROMETER 109

Introducing Accelerometer and AccelerometerEvent 110

Listening for Accelerometer Events 111

Coding the Document Class 111

Running the App 114

Responding to Accelerometer Events 114

Creating the Sphere Class 115

Coding the Document Class 116

Running the App 121

Detecting Shaking 122

Coding the Document Class 122

Running the App 127

Summary 127

CHAPTER 7: IMPLEMENTING AUTO ORIENTATION 129

Enabling Your App to Rotate 129

StageOrientationEvent 130

Two Essentials for UI Reorientation 131

Detecting an Orientation Change 132

Changing Positioning Based on Orientation Changes 138

Summary 144

CHAPTER 8: GEOLOCATION API 145

Getting Geolocation Data 145

Enabling GPS Support for Android 147

Creating a Basic Geolocation Application 148

Coding the Document Class 148

Testing and Running the App 152

Creating a Compass App 153

Coding the Document Class 153

Running the App 159

Creating a Speedometer and Altimeter 160

Embedding a Font in Your App 160

Coding the Document Class 161

Configuring Landscape Orientation 167

Running the App 169

Sending Geolocation to a Web Service 169

Coding the Document Class 170

Running the App 178

Summary 178

CHAPTER 9: SERVICE INTEGRATION USING URL PROTOCOLS 179

Abstracting URL Protocols 180

Making Phone Calls from Your Application 181

Creating PhoneDialer.as 181

Using PhoneDialer in an App 182

Sending SMS Messages 187

Creating SMS.as 188

Adding SMS Support to PhoneServices App 189

Running the App 189

Sending E-mails 191

Creating Mail.as 191

Sending Mail from an App 194

Android: Adding Permissions 196

Running the App 197

Pointing on Google Maps 198

Creating GoogleMaps.as 199

Using GoogleMaps in an App 200

Android: Setting Permissions 206

Running the App 206

Summary 207

CHAPTER 10:ANDROID CAMERA, CAMERA ROLL, AND MICROPHONE 209

CameraUI: Launch and Return 210

Camera: Creating a Live Video Feed 216

Tapping into the Camera Roll 221

Capturing Sounds with the Microphone 228

Summary 234

CHAPTER 11: FILE MANAGEMENT 237

Understanding the Android File and Directory Structure 237

Working with Directories, Files, and File Streams 238

Working with Directories 238

File System Operations 241

Reading and Writing Files 244

Reading a File 245

Writing to a File 246

Android Case Study: Jots 246

Coding the Document Class 248

Running Jots 253

Summary 253

CHAPTER 12: LOCAL DATABASES 255

Working with a SQLite Database 255

Open a Database Connection 256

Creating a Synchronous Connection 256

Creating an Asynchronous Connection 256

Creating Tables 257

Making a SQL Query 262

Inserting and Updating Records 263

Summary 269

PART IV: TESTING AND DEBUGGING

CHAPTER 13: REMOTE DEBUGGING 273

Establishing a WIFI Connection 273

Using the AIR Debug Launcher 274

Android Debugging 274

Remote Debugging inside the Flash IDE 274

Remote Debugging from the Command Line 276

Debugging with Android SDK’s Logcat 277

iOS Debugging 277

Remote Debugging inside the Flash IDE 277

Viewing GPU Rendering Diagnostics 278

Summary 278

CHAPTER 14: SUBMITTING YOUR APP TO THE APP STORE 279

Preparing Your Android App 279

Getting a Screenshot 280

Submitting Your App to the Android Market 281

Registering Your Developer Profile 281

Submitting Your App 282

Preparing Your iOS App 285

Getting a Distribution Certificate 285

Creating a Distribution Provisioning Profile 287

Publishing a Distribution Release of Your App 288

Submitting Your App to the Apple App Store 288

Summary 289

APPENDIX A: APPLICATION DESCRIPTOR SETTINGS 291

APPENDIX B: COMPILING APPLICATIONS

FROM THE COMMAND LINE 305

INDEX 309

loading