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
dtater
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)
Accepted Solution

get text from TextInput inside of different function?

this is all within a single class

 

method 1:

 

 

var txtInpt:TextInput = new TextInput();
txtInpt.width = 250;
searchInpt.text = "Text";
txtInpt.addEventListener(MouseEvent.CLICK, clearSearch);
txtInpt.addEventListener(KeyboardEvent.KEY_DOWN, onKeyBoardEvent);
MyContainer.addChild(searchInpt);

 

 

method 1 creates a bunch of UI elements for a container

 

method 2 -   onKeyBoardEvent - checks to see what the key code was:

 

 

private function onKeyBoardEvent(e:KeyboardEvent):void {
	if (e.keyCode == Keyboard.ENTER) {
			
	stage.focus = null;

// here is where i would trace the text info


	}
			
}

 

Since the Search Input is created in method 1, method 2 does not have access to it

how can i get access to the text entered in the txtInpt in my second method?

 

THANKS!

 

 

- - - - - - - - - -
Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: get text from TextInput inside of different function?

hey dtater,

 

to get access to the textinput object, use this:

 

 

trace(e.currentTarget.text);

 

that should get you what you want. good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Please use plain text.
Developer
dtater
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

Re: get text from TextInput inside of different function?

i *knew* there had to be some way of accessing the properties of the guy that threw the event.

 

 

thanks, again, JRab!

- - - - - - - - - -
Please use plain text.