Subscribe to Tutorial Feed

Flash and PHP Bible

The Flash and PHP Bible has been released! The book can be found on Amazon or wherever fine books are sold in your area.

The Flash and PHP Bible has a forum for quick support.

Scriptplayground » tutorials » as » Getting Started with Blackberry Playbook and AS3

Getting Started with Blackberry Playbook and AS3

Learn the basics of downloading and configuring your workspace for developing Blackberry Playbook apps using ActionScript 3.

You probably heard Adobe announcing all sorts of new technologies and tools to develop with at Adobe MAX 2010. In this tutorial you will learn how to configure your environment and create your first Blackberry Playbook tablet app. Once completed you will be able to develop your own apps just as you would any other Flash mobile project, such as for iPhone or Android.

Before you Begin

Before you start downloading the SDK and tools a few things need to be checked.

If you are planning to develop on a Mac ensure you Java version 1.6 by opening Terminal and running the following command. Note, the "$" is a line marker, you DO NOT type that.

$ java -version

If you do not have the correct version of Java then you need to switch it, which is achieved by running this list of commands, once again in Terminal.

$ cd /System/Library/Frameworks/JavaVM.framework/Versions
$ sudo rm -fr Current
$ sudo ln -s 1.6 Current

Also make sure your Flash Builder is version 4.0.1 or higher, if its not be sure to update it before continuing.

Downloading the Tablet OS SDK

The download process is straightforward, start by downloading the Tablet OS SDK Beta and Simulator beta.

Installing the Tablet OS SDK

As the installation process is "slightly" different for Mac and Windows, both guides have been provided.

Install Instructions for Mac

Once you have downloaded the SDK double-click on the "BlackBerryTabletSDK-air-installer.app" installer and follow the on-screen instructions. Make sure you choose the "Integration with Flash Builder" option as we will be using Flash Builder to develop apps.

Install Instructions for Windows

Once you have downloaded the SDK double-click on the "BlackBerryTabletSDK-air-installer-win.exe" installer and follow the on-screen instructions. Make sure you choose the "Integration with Flash Builder" option as we will be using Flash Builder to develop apps.

Installing VMWare Player or VMWare Fusion

The Blackberry Tablet simulator is actually the complete OS so you must install a virtual machine to run it. For Windows users you can download a copy of VMWare Player, but for Mac the only option is VMWare Fusion. I recommend downloading the 30 day trial and if you find it useful purchase a license. I will leave the installation process of the virtual machine software to you, once installed continue to the next step.

Configure a virtual machine for Tablet OS testing

Follow these steps in order to config the virtual machine.

  • Step 1: Click Install Windows or another operating system in a new virtual machine
  • Step 2: Click Continue without disc
  • Step 3: Select the Use operating system installation disc image file option
  • Step 4: Click Browse, Select the BlackBerryPlayBookSimulator.iso file, Click Choose, Click Continue, Select "Other" for both drop-down lists
  • Step 5: Click Continue
  • Step 6: Click Customize Settings, In the Save As field, type a name for the simulator. Click Save
  • Step 7: In the Settings, click Processors & RAM
  • Step 8: In the RAM section, type 1024 in MB field
  • Step 9: Close the Settings window
  • Step 10: Click the play button beside the virtual machine to start it
  • Step 11: You may be prompted to overwrite /dev/hd0 with the QNX demonstration. Type Y, then press ENTER

Enable development mode

In order to develop for the simulator you must put the OS in development mode. Start by clicking the Gear icon in the upper right of the simulator screen. In the Settings screen, click Security. Be sure to set a Password and Enable development mode, then you are all done. You will see a Hammer icon appear once Development mode is enabled.

Creating your first Blackberry Tablet ActionScript project

Well now that you have downloaded, installed and configured the Blackberry Playbook Tablet OS its time to create your first app. Or another way to look at this, now is time to have some fun.

Start by opening Flash Builder and creating a new Flex Project. Enter "HelloWorldTablet" in the Project Name field. Select "Desktop (runs in Adobe AIR)" and ensure the default SDK is set for the Blackberry Tablet OS.

click Next twice and change the Main Application File to "HelloWorldTablet.as" and finally click Finish to create the project.

In the ActionScript window replace the existing code with the following to create your custom app.

package 
{
	import flash.display.Sprite;
	import flash.text.TextField;

	[SWF(width="1024", height="600", backgroundColor="#ffffff", frameRate="30")]
	public class HelloWorldTablet extends Sprite
	{
		public function HelloWorldTablet()
		{
			var txt:TextField = new TextField();
			txt.text = "Hello Tablet!";
			txt.x = 100;
			txt.y = 100;
			
			addChild(txt);
			stage.nativeWindow.visible = true;
		}
	}
}

Finally save the code and move on to testing the app.

Running your first app in the Simulator

Make sure you followed the steps to enable Development Mode and then proceed to configure Flash Builder for packaging Blackberry Tablet apps. Select "Debug > Other" from the Run menu in Flash Builder and select BlackBerry Tablet AIR Application. Click the New icon to create a new configuration.

Click Browse next to the Project field and select your project in the dialog box. Then on the Main tab, in the Deployment section, in the Target field, type the IP address of your simulator, which can be captured by clicking the Hammer icon in the Blackberry simulator.

Click Apply and then select the Common tab. Check Debug and then click Apply.

Last step, click Debug to launch your application (after a few seconds) on the Blackberry Playbook. Thats it, you have now created your first Blackberry Tablet app using ActionScript 3. In future tutorials we will cover more advanced and device specific topics.

If you have comments or questions about anything in this tutorial be sure to add a comment below.

Follow Scriptplayground on Twitter (@scriptplay)

Comments: Getting Started with Blackberry Playbook and AS3

 Tom Golden  Wed Jan 5, 2011 3:23 pm  
Thank you. This has helped me substantially. Who knows my app might be as successful as Angry Birds! ;)
 mkeefe  Wed Jan 5, 2011 6:26 pm  
@Tom - Glad the article helped you! I am working on some more for the Blackberry Playbook as well as other mobile devices.

If you have an app idea be sure to register for the App World Playbook promotion from Blackberry.
 mohsin  Wed Jan 19, 2011 1:29 am  
Its good information i have tried the helloworld example and it works but Actually I want to convert the one as3 game into blackberry playbook,but i was getting an error like

1119: Access of possibly undefined property nextButton through a reference with static type

1172: Definition fl.transitions:Tween could not be found.

1180: Call to a possibly undefined method Tween.


1120: Access of undefined property TweenEvent.

1061: Call to a possibly undefined method startGame through a reference with static type

1046: Type was not found or was not a compile-time constant: Tween.

please help me to solve this problem







 mkeefe  Mon Feb 7, 2011 7:59 am  
@mohsin - It sounds like you aren't importing the Tween library and possibly have misplaced a button. You can also check for cached classes by deleting the ASO files.
 JK  Thu Sep 29, 2011 7:09 am  
Is it possible to do the same with Flash CS 5.5? In the Flash IDE I can build "AIR for Android" and "AIR for iOS" but I can't see anything about Blackberry...
Add a comment
The ability to add new comments has been disabled in this archived version.

Loading
Main | Tutorials | Articles