Creating your first application in Flash Builder

Before you Begin:

The following steps help you create an application that prints a simple "Hello World!" example on the screen.

Create an Adobe ActionScript Mobile AIR project

  1. In Adobe Flash Builder, on the File menu, click New > ActionScript Mobile Project.
  2. In the Project name field, type AIRHelloWorld.
  3. In the Flex SDK version section, select the Use default SDK option.

    Create an ActionScript Mobile AIR Project screen - Project Location

  4. Click Next.
  5. In the Target platforms section, clear the Apple iOS and Google Android check boxes.

  6. Click Next.
  7. In the Native Extensions tab, specify the following ActionScript native extensions:

    By specifying ActionScript native extensions in your project, you can access native platform features such as the sensors and network API.

    1. Click Add Folder.
    2. In the Add ANEs window, specify the location of the ActionScript native extensions.

      The default location for the ActionScript native extensions in a Windows environment is \Program Files\Research In Motion\blackberry-tablet-sdk-2.1.0\frameworks\libs\qnx\ane.


      The default location for the air native extensions in a Mac environment is /Applications/Research In Motion/blackberry-tablet-sdk-2.1.0/frameworks/libs/qnx/ane.

    3. Click Ok.
  8. Click Finish.

Configure the build and packaging settings

  1. In the Package Explorer view, right-click your Adobe ActionScript mobile project.
  2. Click Properties.
  3. Expand ActionScript Build Packaging.
  4. Click BlackBerry.
  5. Select the Add platform specific libraries to library path check box.
  6. Save your project.

Force Adobe AIR runtime to version 3.1

Your Adobe Flash Builder installation may not be using Adobe AIR runtime version 3.1. In order to compile and deploy your BlackBerry 10 application, you must force Flash Builder to use version 3.1 of the Adobe AIR runtime.

  1. In the Package Explorer view, right-click your ActionScript mobile project.
  2. Click Properties.
  3. Click ActionScript Compiler.
  4. In the Additional compiler arguments field, type -swf-version 14.
  5. Click Apply.
  6. Expand ActionScript Build Packaging. Click BlackBerry.
  7. In the Advanced tab, in the Extra packaging option field, type -forceAirVersion 3.1.
  8. Click Apply.
  9. Click OK.

Clean your project
  1. On the Project menu, click Clean.
  2. On the Clean window, select the checkbox for your project.
  3. Click OK.

Update the project namespace

If you are using Adobe AIR SDK 3.1 (The default SDK for Flash Builder 4.6), you can skip this section.

If you are importing a project from a previous version of Flash Builder, you must update the namespace of your project to the version of the AIR runtime used by your Flash Builder installation.
  1. Open the <Project>-app.xml file.
  2. In the <application> element, set the XML namespace to the version of your AIR runtime.

    For example, using AIR runtime 3.1: <application xmlns="">

  3. Save your file.

Create your source code

In the text editor pane, replace the default code for by copying and pasting the following code sample:

	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import qnx.fuse.ui.text.Label;
	[SWF(height="600", width="1024", frameRate="60",

	public class AIRHelloWorld extends Sprite
		public function AIRHelloWorld()

			// support autoOrients
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;

			//Initialize the UI

		private function initializeUI():void
			// create a label
			var myLabel:Label = new Label();

			// Define a label width
			myLabel.width = 200;

			// set the label to appear at the center of the
			// screen
			myLabel.x =
				(stage.stageWidth - myLabel.width) /2;
			myLabel.y =
				(stage.stageHeight - myLabel.height) /2;

			// set the label text to "Hello World!"
			myLabel.text = "Hello World!";

			// add the label to the screen

Add an icon to your Adobe ActionScript project

Before you begin: Create an image in PNG format with a maximum resolution of 86 x 86 pixels.

  1. In Adobe Flash Builder, in the Package Explorer pane, in your project tree, right-click the src folder.
  2. Click Import.
  3. Expand General, and select File System.

    Import a File screen

  4. Click Next.
  5. Beside the From directory field, click Browse.
  6. Find the folder that contains your image.
  7. Click OK.
  8. Select the check box beside your image.

    Import from File System screen.

  9. Click Finish.

After you finish: You must update the bar-descriptor.xml file to notify the BlackBerry Tablet OS that the image is the icon for your application.

Update your bar-descriptor.xml configuration file

As of BlackBerry Tablet OS SDK version 2.0, the blackberry-tablet.xml has been renamed to bar-descriptor.xml.

  1. In Adobe Flash Builder, in the Package explorer view, in the src folder for your project, double-click the bar-descriptor.xml file.
  2. In the text editor pane for bar-descriptor.xml, update the value of the image element to use your icon. Between the image elements, replace your_image.png with the name of your image file.


  3. On the File menu, click Save.

Next Steps

To set up a run or debug configuration, and test your application, see Testing your application.