Code sample: Create a simple password change field

package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.MouseEvent;

	
	import qnx.fuse.ui.text.TextTruncationMode;
	import qnx.fuse.ui.text.TextFormatStyle;
	import qnx.fuse.ui.buttons.LabelButton;
	import qnx.fuse.ui.core.Container;
	import qnx.fuse.ui.layouts.Align;
	import qnx.fuse.ui.layouts.gridLayout.GridData;
	import qnx.fuse.ui.layouts.gridLayout.GridLayout;
	import qnx.fuse.ui.text.Label;
	import qnx.fuse.ui.text.TextFormat;
	import qnx.fuse.ui.text.TextInput;
	import qnx.uitest.views.BaseView;
	import flash.events.MouseEvent;

	
	[SWF(height="1280", width="768", frameRate="60", backgroundColor="#FFFFFF")]
	public class GridResizeExample extends Sprite
	{
	
		private var mainContainer:Container;
		private var topGrid:GridLayout;
		private var labelPassword:Label;
		private var labelConfirmPass:Label;
		private var text1:TextInput;
		private var text2:TextInput;
		private var labelHint:Label;	
		private var myGridData:GridData;
		private var buttonGridData:GridData;
		private var myTextFormat:TextFormat;
		private var buttonSubmit:LabelButton;

		private var valShort:String;
		private var valLong:String;
		
		
		public function GridResizeExample()
		{
			super();
			
			// support autoOrients
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			initUI();
		}
		
		
		private function initUI():void
		{
			
			valShort = "*Password hint";
			valLong = "Your password must be at least 8 characters in length, " +
			"and no more than 12 characters in length. " +
			"Your password must contain at least three of the following: a " +
			"capital letter, a lower case letter, a number, " +
			"a special character. You cannot use passwords that you have " +
			"used within the past 365 days. ";

			mainContainer = new Container();
			mainContainer.setActualSize(stage.stageWidth, stage.stageHeight);			
			this.addChild(mainContainer);

			topGrid = new GridLayout();
			mainContainer.layout = topGrid;
			topGrid.padding = 30;
			topGrid.spacing = 20;
			topGrid.numColumns = 2;

			myGridData = new GridData();
			myGridData.hSpan = 2;	
			myGridData.marginLeft = 5;
			myGridData.marginRight = 20;

			buttonGridData = new GridData();
			buttonGridData.hSpan = 2;
			buttonGridData.hAlign = Align.END;

			myTextFormat = new TextFormat();			
			myTextFormat.style = TextFormatStyle.SECONDARY;
			myTextFormat.color = 0xFF0000;

			labelPassword = new Label();
			labelPassword.text = "New password:";			
			mainContainer.addChild(labelPassword);

			text1 = new TextInput();
			mainContainer.addChild(text1);	

			labelHint = new Label();
			labelHint.maxLines = 0;
			labelHint.truncationMode = TextTruncationMode.CLIP;
			labelHint.addEventListener(MouseEvent.CLICK, onButtonClick);
			labelHint.text = valShort;
			labelHint.format = myTextFormat;
			labelHint.layoutData = myGridData;
			mainContainer.addChild(labelHint);

			labelConfirmPass = new Label();
			labelConfirmPass.text = "Confirm new password:";			
			mainContainer.addChild(labelConfirmPass);

			text2 = new TextInput();
			mainContainer.addChild(text2);

			buttonSubmit = new LabelButton();
			buttonSubmit.label = "Submit";
			buttonSubmit.layoutData = buttonGridData;
			mainContainer.addChild(buttonSubmit);

	
		}
		
		private function onButtonClick(e:MouseEvent):void
		{
			
			if (labelHint.text == valShort)
			{
				trace(valLong);
				labelHint.text = valLong;
			}else{
				trace(valLong);
				labelHint.text = valShort;
			}
			
		}
		
	}
}