Wednesday, May 4, 2011

Building BlackBerry PlayBook Apps with Flash Professional CS5

First thing is to note that BlackBerry Tablet OS SDK for AIR comes from BlackBerry and has some API's that do not work on AIR on the Desktop. If you end up using some of the PlayBook specific API's you will have to test your applications on the simulator (or device) itself. I assume in this article that you have downloaded the BlackBerry Tablet OS SDK and have it installed on your computer. I will be using the default install path of c:\Program Files\Adobe\Adobe Flash Builder 4\sdks\blackberry-tablet-sdk-0.9.0 (Windows) and /Application/Adobe Flash Builder 4/sdks/blackberry-tablet-sdk-0.9.0 (Mac) in this article but just swap the path to the sdk with your local computer specific location.

Next step is to make sure you have the Flash Professional CS5 Extension for AIR 2.5installed on your computer.
Create your new Flash CS5 project with the Adobe AIR settings, specifically targeting AIR 2.5.

In the properties panel click on the Edit button to the right of Adobe AIR 2.5 Settings. On the General tab, deselect all the Profiles expect the "Mobile Device" profile. On the same General tab also provide a value for the Copyright field. Now switch to the Signature tab and select the "Prepare an AIR Intermediate (AIRI) file that will be signed later" option. Click OK.
Now for the setting up the BlackBerry Tablet OS SDK libraries in the class path. In the properties panel click on the Edit button to the right of ActionScript Settings. With the Library path tab select remove the default $(AppConfig)/ActionScript 3.0/libs and textLayout.swc references. Then proceed to add 3 new swc paths.
Steps to add paths:
Click on Add New Path button.
Select the new path and click on Browse To Path.
Select the correct path and click Open.
Follow the previous steps for the following 3 paths:
/Applications/Adobe Flash Builder 4/sdks/blackberry-tablet-sdk-0.9.0/frameworks/libs/blackberry
/Applications/Adobe Flash Builder 4/sdks/blackberry-tablet-sdk-0.9.0/frameworks/libs/qnx-screen
/Applications/Adobe Flash Builder 4/sdks/blackberry-tablet-sdk-0.9.0/frameworks/libs/air
For the first two the default setting of Merged into code is what we want. But for the path to the frameworks/libs/air you need to expand the path icon and double click on the linking option and change it to External. You should end up with something like this:
Now you code up your application.
When you want to test it you first Publish (File -> Publish). Then on the command line navigate to your application's publish location. Using BlackBerry Tablet OS SDK's package and deploy scripts it will look something like this:
sh-3.2# /Applications/Adobe\ Flash\ Builder\ 4/sdks/blackberry-tablet-sdk-0.9.0/bin/blackberry-airpackager -package FlashCS5RIM.bar -installApp -launchApp FlashCS5RIM-app.xml FlashCS5RIM.swf -device 192.168.115.135

No comments:

Post a Comment