beefing up air - fitc ams 2012

Post on 28-Jun-2015

10.276 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Presentation given at FITC Amsterdam 2012.AIR has been the cross device platform to deploy interactive applications. This session shows you how you can extend the default capabilities and add native interaction and performance to your applications.

TRANSCRIPT

Native extensions in AIR 3.0

BEEFING UP AIR

@WOUTER

•Wouter Verweirder

• blog.aboutme.be

• Lecturer @ HOWEST

• Partner @ Happy Banana

• AS3NUI / AIRKinect

1.What is a native extension

2.Build a native extension

1. Hello World

2. Working with AS Objects

3. Threading / Communication

4. What about Android

3.Use a native extension

4.AIRKinect extension

5.Q & (hopefully) A

SESSION OVERVIEW

WHAT IS A NATIVE EXTENSION?

• Extend the features of the AIR runtime !

• For TV, Mobile, Desktop

Flex

ActionScript

AIR

OS

extension

AS3

DLL

AS3

JAR...

WHAT IS A NATIVE EXTENSION?

library.swf

ext.dll

library.swf

ext.jar...

extension.xml

catalog.xmllibrary.swf

ANE FILE STRUCTURE

ANE FILE STRUCTURE

REGULAR SWC FILE

ANE FILE STRUCTURE

ANE FILE

WHY?

• access native platform specific code libraries

• Re-use legacy native code

• Increase performance (native performance / threading)

WRITING AN EXTENSION

• ActionScript: ExtensionContext class

•Native:

• C entry point on Windows, OSX, iOS (& Android)

• Java entry point on Android

WRITING AN EXTENSION

adt ane file

1. Create ExtensionContext object

2. Look up link with native code in XML

3. Link the context initializer

4. Link the native functions in the context initializer

5. Call a method in native code

context initializer

context finalizer

function calls & events

extension initializer

extension finalizer

Demo Hello World

• Construct new AS3 Objects

• Get AS3 Object Type

• Get / Set properties of AS3 Objects

• Call AS3 Object methods

WORKING WITH AS OBJECTS

WORKING WITH AS OBJECTSSIMPLE DATA TYPES

WORKING WITH AS OBJECTSAS CLASS INSTANCES

WORKING WITH AS OBJECTSEXAMPLE:

ARRAY / VECTOR METHODS

BYTEARRAY / BITMAPDATA

acquire

release

memory access No other API methods are allowed here

BYTEARRAY / BITMAPDATA

BYTEARRAY / BITMAPDATA

EXAMPLE:

Demo ByteArray Access

THREADING• Is allowed in the native extension :-)

•NO FRE API calls allowed outside the main thread

• except for : FREDispatchStatusEventAsync

THREADING

Demo Threading

WHAT ABOUT ANDROID ?

• C API for Windows, OSX & iOS

• Java Wrapper for Android:

• com.adobe.fre.FREExtension

• com.adobe.fre.FREContext

• com.adobe.fre.FREFunction

create instance of...

returns collection of...

WHAT ABOUT ANDROID ?

EXAMPLE:

EXAMPLE:

WHAT ABOUT ANDROID ?

WHAT ABOUT ANDROID ?

EXAMPLE:

Demo Mobile UDP extension

library.swf

ext.dll

library.swf

ext.jar...

extension.xml

catalog.xmllibrary.swf

PACKAGING AN ANE

1.Compile SWC of your AS3 code

2.Unzip SWC file, get library.swf file

3.Put swc, library.swf, extension.xml & native builds (dll, ...) in one directory

4.Run adt command

PACKAGING AN ANE

adt -package -storetype pkcs12 -storepass p@ssw0rd -keystore key.p12 -tsa none -target ane HelloWorldExtension.ane extension.xml -swc helloworldas.swc -platform MacOS-x86 library.swf HelloWorld.framework -platform Windows-x86 library.swf HelloWorld.dll

http://help.adobe.com/en_US/air/build/WS789ea67d3e73a8b22388411123785d839c-8000.html

PACKAGING AN ANE

BUILDING APPS WITH ANE’S

BUILDING APPS WITH ANE’S

BUILDING APPS WITH ANE’S

AIRKINECT

•Native extension to use the Kinect in your AIR apps

• Current version: 1.7.1

• Full skeleton Data

• Camera Streams: RGB & Depth

• Point Cloud info

Created By Tim Camerlinckx - http://vimeo.com/34614887

Created By Yannick Van der Goten - http://vimeo.com/34563640

Created By Laurents Laire - http://vimeo.com/34264122

Created By Simon Pertz - http://vimeo.com/34681243

AIRKINECT 2.0

• Simplified API

•New features:

• Skeleton Joint Rotations

• User center-of-mass

• Point Cloud Regions

• IR Camera Stream

Time for some Kinect coding!

Questions(and hopefully some answers...)

Thank you!

@wouterhttp://blog.aboutme.behttp://www.as3nui.com

http://www.happy-banana.be

top related