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="1280", width="768", 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);
}
}
}