Building BlackBerry PlayBook Apps with Flash Professional CS5

Note: At some point BlackBerry will come out with support Flash Professional CS5. This article is meant to help those brave developers wanting to build playbook apps with Flash CS5 now.

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.

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.

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:

thanks for this tutorial Renaun… I’d like to just ask you some more infos about the next support for CS5 Pro… you said “at some point” that sounds a bit too generic, are we sure that will happen? You know, actually it’s great to dev for android, starting quickly from the template in the CS5 menu, and will be useful do to the same also for the PlayBook, isn’t it?

http://www.renaun.com Renaun Erickson

That is definitely the direction and ideal workflow. Just hard to give time lines on future features.

http://gregoire.org/ Paul Gregoire

Awesome! Thanks for leg-work on this Renaun :) Now is the time for me to work on my app, so that I can get my hands on one of those playbooks.

Obviously, the playbook simulator needs to be in dev mode, and running in the background.

http://www.renaun.com Renaun Erickson

Yes, you don’t have to remove the Flash AS3 lib if you are using those classes. Thanks for the windows example of the command line call

http://none Nick

Hey Renaun, great post, also saw your webcasts on the blackberry site. I’ve build an air app and successfully ran it in the playbook simulator, however as soon as I try to use a playbook specific method, like showing an alert, I get errors like “VerifyError: Error #1079: Native methods are not allowed in loaded code.” and “ReferenceError: Error #1065: Variable Button is not defined.”….”ReferenceError: Error #1065: Variable Rebound_Banner is not defined.” Can you explain this? Thanks.

http://www.renaun.com Renaun Erickson

Are you talking about seeing these errors in the PlayBook simulator or on the desktop? If its the simulator can you post some code that I try.

Nick

Sorry it wasn’t letting me post for some reason, maybe there is a char limit or something, or it thinks what i’m posting is spam? Uploaded it here. http://cl.ly/3mqq

Nick

Well I narrowed it down to using methods, like “alert.show()” in Flash Pro CS5 that are causing the error, I am able to use qnx ui elements like buttons, lists, scroll-panes without a problem. I understand using the method on the desktop wont work because its mean for the simulator/device, so how do I compile a swf without those errors to test those functions in the simulator?

I have been able to successfully build and run from flash builder burrito, but I can’t seem to be able to work with fb4 on anything larger than small tests…

I have the eventual goal to port my flash iphone game to the playbook, it has no device specific code and would run well… if i could get it running

I’ve been trying these and many other guides and tuts, and compiling from the command line can get my application installed, but when it looks like it finishes loading, it quits back to the main menu. Eg, my apps only ever show the loading screen and nothing more.

Is this a known issue/ any ideas on how to fix or workaround it?

Thanks in advance

Scott

http://www.renaun.com Renaun Erickson

Its very possible that its a bug with the current PlayBook SDK/Tablet OS. I don’t know of any fixes per say, can you narrow down which code is causing the error?