Creating your first application in Flash Builder
- Install the BlackBerry Tablet OS SDK for Adobe AIR.
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
- In Adobe Flash Builder, on the File menu, click New > ActionScript Mobile Project.
- In the Project name field, type AIRHelloWorld.
- In the
Flex SDK version section, select the
Use default SDK option.
- Click Next.
- In the
Target platforms section, clear the
Apple iOS and
Google Android check boxes.
- Click Next.
- 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.
- Click Add Folder.
- 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.
- Click Ok.
- Click Finish.
Configure the build and packaging settings
- In the Package Explorer view, right-click your Adobe ActionScript mobile project.
- Click Properties.
- Expand ActionScript Build Packaging.
- Click BlackBerry.
- Select the Add platform specific libraries to library path check box.
- 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.
- In the Package Explorer view, right-click your ActionScript mobile project.
- Click Properties.
- Click ActionScript Compiler.
- In the Additional compiler arguments field, type -swf-version 14.
- Click Apply.
- Expand ActionScript Build Packaging. Click BlackBerry.
- In the Advanced tab, in the Extra packaging option field, type -forceAirVersion 3.1.
- Click Apply.
- Click OK.
Clean your project
- On the Project menu, click Clean.
- On the Clean window, select the checkbox for your
project.
- 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.
- Open the <Project>-app.xml file.
- In the <application>
element, set the XML namespace to the version of your AIR runtime.
For example, using AIR runtime 3.1: <application xmlns="http://ns.adobe.com/air/application/3.1">
- Save your file.
Create your source code
In the text editor pane, replace the default code for AIRHelloWorld.as by copying and pasting the following code sample:
package { 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", backgroundColor="#FFFFFF")] public class AIRHelloWorld extends Sprite { public function AIRHelloWorld() { // support autoOrients stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; //Initialize the UI initializeUI(); } 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 addChild(myLabel); } } }
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.
- In Adobe Flash Builder, in the Package Explorer pane, in your project tree, right-click the src folder.
- Click Import.
- Expand
General, and select
File System.
- Click Next.
- Beside the From directory field, click Browse.
- Find the folder that contains your image.
- Click OK.
- Select the check box
beside your image.
- 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
- In Adobe Flash Builder, in the Package explorer view, in the src folder for your project, double-click the bar-descriptor.xml file.
- 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.
<icon> <image>your_image.png</image> </icon>
- On the File menu, click Save.
Next Steps
To set up a run or debug configuration, and test your application, see Testing your application.