Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
DT655
Posts: 71
Registered: ‎04-27-2011
My Device: Bold 9700 and Playbook 64
My Carrier: Rogers

Re: Text input in modal dialog

I notice if I put any code in the function that is called in the main app when the user clicks done, it won't compile.

I get a implicit coercion error 1067
Please use plain text.
Developer
DT655
Posts: 71
Registered: ‎04-27-2011
My Device: Bold 9700 and Playbook 64
My Carrier: Rogers

Re: Text input in modal dialog

Heres the code for my main:

 

	public class PPV extends Sprite
	{
		private var _setPassword:InputDialog;
		private var _inputPassword:InputDialog;
				
		public function PPV()
		{
			super();
			
			//################ Check for Password #################
			var password:flash.net.SharedObject;
			password = SharedObject.getLocal("PPV_password");
			
			if (!password.data.string) {
				_setPassword = new InputDialog(this);
				addChild(_setPassword);
			} else {  
			}
		}
		
		public function clickInput(e:MouseEvent):void
		{
			//any code put in here gives me the 1067 error.
		}

 

and this is the inputdialog class copied from thread:

 

package com.mydomain.ppv.ui
{
	import flash.display.Graphics;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;
	
	import qnx.ui.buttons.LabelButton;
	import qnx.ui.core.UIComponent;
	import qnx.ui.text.TextInput;
		
		public class InputDialog extends UIComponent
		{
			public var inputText:TextInput = new TextInput();
			public var inputText2:TextInput = new TextInput();
			
			public function InputDialog(main:PPV)
			{
				width = 1024
				height = 600
				
				var myFormat:TextFormat = new TextFormat()
				myFormat.color = 0x000000  
				myFormat.size = 32
				myFormat.align = "center"
				
			/*	var titleText:TextField = new TextField()
				titleText.text = "Title"
				titleText.width = 500
				titleText.x = 260
				titleText.y = 100
				titleText.setTextFormat(myFormat)
				addChild(titleText)
			*/	
				myFormat.size = 22
				var instText:TextField = new TextField()
				instText.text = "PPV - Create Password"
				instText.width = 500
				instText.x = 260
				instText.y = 60
				instText.setTextFormat(myFormat)
				addChild(instText)
				
				inputText.width = 240
				inputText.x = 392
				inputText.y = 100
				inputText.height = 40
				inputText.prompt = "Type new password"
				addChild(inputText)
				
				inputText2.width = 240
				inputText2.x = 392
				inputText2.y = 150
				inputText2.height = 40
				inputText2.prompt = "Re-type password"
				addChild(inputText2)
				
				var doneButton:LabelButton = new LabelButton()
				doneButton.label = "Set Password"
				doneButton.x = inputText.x
				doneButton.y = 200
				doneButton.width = 240
				doneButton.height = 45	
				doneButton.addEventListener(MouseEvent.CLICK,main.clickInput);
				addChild(doneButton)
			}
			
			override protected function draw():void
			{
				var g:Graphics = graphics;
				g.clear();
				g.beginFill(0x000000,.9);
				g.drawRect(0,0,1024,600);
				g.endFill();
				g.beginFill(0xDDDDDD,1.0);
				g.drawRoundRect(362,45,300,220,10);
				g.endFill();
			}
		}
}

 

 

 

Please use plain text.
Developer
DT655
Posts: 71
Registered: ‎04-27-2011
My Device: Bold 9700 and Playbook 64
My Carrier: Rogers

Re: Text input in modal dialog

Note to others reading this,

 

I am using the 'Community Library' now to call dialog boxes.

 

If you search for community library you will get more information.

Please use plain text.