Create your source code

In the FDT Explorer, expand the src folder. Open the AIRHelloWorld.as file in a text editor and replace the default code with the following code sample, where <your package name> is the package name defined in the new FDT project:

package <your package name>
{
	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);		
		}
	}
}
comments powered by Disqus