On smart-phones and tablets with AIR runtime 2.7 only one camera of two (when possible) is accessible. How to manage camera, how to indicate what camera is front-facing etc.?
Similar problem already solved by Phillip Chertok in his recipe http://cookbooks.adobe.com/post_How_do_I_access_the_front_facing_camera_on_a_mobil-19312.html . But this doesn't work "from the box" because there no AIR 3.0 for mobile devices yet. We have to pack runtime with our app.
We have to "finalize" Phillip's solution a bit. There some nice articles about how and why shall do it:
http://www.tricedesigns.com/2011/08/10/air-3-0-captive-runtime/
http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac1e63e3d128cdca935b-8000.html
http://www.remotesynthesis.com/post.cfm/cool-stuff-with-the-flash-platform-8-19-2011
In this recipe we have Adobe Flash Builder 4.5 project and want to publish it for use on Android 3.0 (so, get .apk file with Adobe 3.0 runtimed merged into it).
So, after we install Adobe AIR 3.0 Release Canditate from http://labs.adobe.com/technologies/flashplatformruntimes/air3/ , merge sdk from the same page to one we use (I use 4.5.1) and install Adobe Flash Player 11 Release Candidate from http://labs.adobe.com/technologies/flashplatformruntimes/flashplayer11/ (download playerglobal.swc and replace with it player from sdk you use) we shall add "-swf-version=13" compilator argument to project in Flash Builder 4.5 and compile new .swf file.
Than we have to package our app together with runtime in .apk file using adt tool from AIR sdk. I created .bat file to use it on Microsoft Windows and it contains following commands:
"C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.5.1\bin\adt.bat" -package -target apk-captive-runtime -storetype pkcs12 -keystore cert.p12 bin-debug/MyApp.apk MyApp-pack.xml bin-debug/MyApp.swf bin-debug/assets/* bin-debug/images/* data.db
you can find a lot about how to use adt tool in http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac1e63e3d128cdca935b-8000.html article.
You also have to fix a bit application description file. I copied one created by Flash Builder into file VirtualNurse-pack.xml and added "bin-debug" prefix to .swf content and to icons images: <initialWindow> <content> bin-debug/MyApp.swf</content> </initialWindow> , <image16x16>bin-debug/assets/nurseIcons/16.png</image16x16> etc.
After all the parameters will be successfully tuned on run this .bat file and enjoy obtained .apk file about 7 Mb more "heavy" then one created by puiblish from Flash Builder. Install and run this .apk file on your Android device - you will have full controll over cameras.
+