• No results found

[PACKTl. Flash Development for Android Cookbook. Flash, Flex, and AIR. Joseph Labrecque. Over 90 recipes to build exciting Android applications with

N/A
N/A
Protected

Academic year: 2021

Share "[PACKTl. Flash Development for Android Cookbook. Flash, Flex, and AIR. Joseph Labrecque. Over 90 recipes to build exciting Android applications with"

Copied!
5
0
0

Loading.... (view fulltext now)

Full text

(1)

Flash

Development

for

Android Cookbook

Over 90

recipes

to

build

exciting

Android

applications

with

Flash,

Flex,

and AIR

Joseph Labrecque

[PACKTl

III

IV

I V I

J

PUBLISHING

(2)

Table

of Contents

Preface

1

Chapter

1:

Getting

Ready

to Work with Android:

Development

Environment

and

Project

Setup

7 Introduction 8

Using

Flash Professional CS5.5to

develop

Android

applications

8

Targeting

AIR for Android with Flash Professional CS5.5 10

Using

Flash Builder 4.5 to

develop

Android

applications

13

Enabling

Flash Builder4or Flex Builder toaccess FlexMobile SDKs 15

Using

Flash Builder 4 and belowto

develop

Android

applications

18

Enabling

Powerflasher FDT 4.1toaccessFlex Mobile SDKs 21

Using

Powerflasher FDT 4.1 and below to

develop

Android

applications

23

Converting

astandard Flex

project

toa Flex Mobile

project

26

Configuring

the AIRSDKto

package

AIR forAndroid

applications

on Windows 29

Configuring

theAIRSDKto

package

AIR for Android

applications

on

Linuxor MacOS 30

Chapter

2:

Interaction

Experience: Multitouch,

Gestures,

and Other

Input33

Introduction 34

Detecting supported

device

input

types 34

Detecting

whetheror nota device

supports

multitouch 36

Verifying specific gesture

support

forcommon interactions 38

Using

gestures

tozoom a

display

object

41

Using gestures

topan a

display object

43

Using gestures

to

swipe

a

display object

46

Using

gestures

to rotatea

display object

49

Accessing

raw

touchpoint

data 52

Creating

a custom

gesture

based upon touchPointdata 55

(3)

Table ofContents

Invoking

the virtual

keyboard programmatically

62

Responding

toAndroid

soft-key

interactions 66

Responding

to trackball andD-Pad events 68

Chapter

3:

Movement

through Space:

Accelerometer and

Geolocation Sensors

Z3

Introduction 74

Detecting

whetheror notanAndroid device

supports

the accelerometer 74

Detecting

Android device movementin 3Dspace 76

Adjusting

the accelerometer sensor

update

interval 78

Updating display object position

through

accelerometerevents 82

Switching

between

portrait

and

landscape

based upon device tilt 86

Detecting

whether or nota device

supports

a

geolocation

sensor 89

Retrieving

device

geolocation

sensordata 93

Adjusting

the

geolocation

sensor

update

interval 96

Retrieving

map data

through geolocation

coordinates 101

Chapter

4: Visual and Audio

Input:

Camera and

Microphone

Access 107 introduction 107

Detecting

camera and

microphone support

108

Using

thetraditional camera API tosave a

captured image

110

Using

the Mobile CameraUl APItosave a

captured photograph

113

Using

the Mobile CameraUl API to save a

captured

video 118

Using

the device

microphone

tomonitor audio

sample

data 122

Recording

Microphone

Audio

Sample

Data 125

Chapter

5: Rich

Media Presentation:

Working

with

Images,

Video,

and Audio 131 Introduction 131

Loading photographs

from the device cameraRoll 132

Applying

Pixel Bender Shader effects toloaded

images

136

Playing

video files from the local

filesystem

or over HTTP 141

Playing

remote video streamsover RTMP 146

Playing

audiofiles from the local

filesystem

or overHTTP 152

Generating

anaudio

spectrum

visualizer 156

Generating

audio tones foryour

application

159

Chapter

6: Structural

Adaptation:

Handling

Device

Layout

and

Scaling

163 Introduction 164

Detecting

useable screenbounds and resolution 164

Detecting

screen orientation

changes

166

Scaling

visual elementsacrossdevices at runtime 169

Scaling

visual elements based on

stage

resize in Flash Professional CS5.5 172

(4)

Employing

the

Project panel

in Flash Professional CS5.5 176

Freezing

aFlex

application

to

landscape

or

portrait

mode 179

Defining

ablank Flex mobile

application

183

Defining

a Flex mobile view-based

application

185

Defining

aFlex mobile tabbed

application

with

multiple

sections 188

Using

a

splash

screen within a Flex mobile

application

191

Configuring

the ActionBar withinaFlex mobile

project

foruse with

ViewNavigator

194

Hiding

the ActionBar control in a

single

view

fora Flex mobile

project

198

Chapter

7:

Native Interaction:

StageWebView

and URI Handlers

201

Introduction 201

Opening

awebsite in the default Android browser 202

Rendering

awebsite within an

application

205

Managing

the

StageWebView history

210

Using StageWebView

to load ads

using ActionScript

216

Using StageWebView

toload ads withinaFlex mobile

project

219

Making

a

phone

callfroman

application

225

Sending

a text messagefroman

application

228

Invoking Google

maps from an

application

231

Invoking

the Android Market

using

application

URIs 236

Sending

e-mail froman

application

239

Chapter

8: Abundant Access;

File

System

and Local

Database 243 Introduction 243

Opening

a local file from device

storage

244

Saving

a file to device

storage

247

Saving

data acrosssessions

through

local shared

object

252

Storing application

state

automatically by using

Flex 257

Creating

a local

SQLite

database 260

Providing

adefault

application

database 266

Automating

database tasks with FlexORM 271

Chapter

9: Manifest Assurance:

Security

and Android Permissions

279

Introduction 279

Setting application permissions

with the Android Manifest file 280

Preventing

the devicescreenfrom

dimming

283

Establishing

Android custom URI schemes 286

Anticipating

Android

Compatibility Filtering

290

Instructing

an

application

to be installed to Device SDCard 292

Encrypting

a local

SQLite

database 294

(5)

too-Table of Contents

Chapter

10:

Avoiding

Problems:

Debugging

and

Resource

Considerations

301

Introduction

301

Debugging

an

application

with Flash Professional 302

Debugging

an

application

with Flash Builder 305

Rendering application

elements

using

thedevice GPU 310

Automating application

shutdownupondevice

interruption

events 311

Exiting

your

application

with the device back button 313

Monitoring

memory

usage

and frame rate in an

application

314

Chapter

11: Final Considerations:

Application Compilation

and

Distribution

319

Introduction

320

Generating

a

code-signing

certificate

using

Flash Professional 320

Generating

a

code-signing

certificate

using

Flash Builder 322

Generating

a

code-signing

certificate

using

FDT 323

Generating

a

code-signing

certificate

using

the AIR

Developer

Tool 325

Preparing

icon files for distribution 327

Compiling

an

application using

Flash Professional 330

Compiling

an

application

using

Flash Builder 334

Compiling

an

application

when

using

FDT 336

Compiling

an

application using

the AIR

Developer

Tool 337

Submitting

an

application

tothe Android Market 339

Index

343

References

Related documents

Taking selfies and sharing photos on popular social media platforms like Facebook and Twitter are considered to be one of the biggest contributors to the rise in narcissistic

When the operator moves the blade control lever to the SINGLE TILT When the operator moves the blade control lever to the SINGLE TILT RIGHT position, supply oil is sent to the head

The Wang viewer can be started via the function Create links ® And store document within generic object services (see Storing Documents Generically [Page 109] [Page 109] ). A

RQ1 Do Lehman’s law of continuing change, increasing complex- ity, and declining quality apply to mobile apps.. RQ2 Do Lehman’s laws apply to mobile apps and their desktop version

Understanding Students’ Intentions to Join the Hospitality Industry: The Role of Emotional Intelligence, Service Orientation, and Industry Satisfaction.. Kate Walsh 1 , Song Chang

 Refunds for extended tours are processed if cancellation is received 4 weeks prior to overnight trip, except where otherwise noted.  Trip cancellation insurance is

You can retouch KODAK PROFESSIONAL TRI-X 320 Film (120, 220 and sheet sizes) by applying liquid dyes to the base or emulsion side..