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
ddluk
Posts: 212
Registered: ‎10-02-2010
My Device: Z10 and Z30
Accepted Solution

How to get TextInput value

I wrote following code:

 

 

			var wpisz:TextInput = new TextInput();
			wpisz.setPosition(300,500);
			wpisz.text = "";

 

What I'm trying to do is to get that text value after user click button. So user enter value then click button and then in the label that entered value is displayed. How to do that?

 

Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: How to get TextInput value

[ Edited ]
Try something like this:
// add imports here

// set SWF params here
public class MyApp extends Sprite
{
  private var text_input : TextInput = new TextInput();
  private var button     : LabelButton = new LabelButton();

  ////////////////////////////////////////////
  public function MyApp()
  {
    super();
    // set attribute location and size information here

    this.addChild( this.text_input );

    this.button.label = 'Press Me';
    this.button.addEventListener( MouseEvent.CLICK, DoClick );
    // set btn size and location here
    this.addChild( this.button);

    this.stage.nativeWindow.visible = true;
  }

  ////////////////////////////////////////////////
  private function DoClick( event : Event ) : void
  {
    this.button.label = this.text_input.text;
  }
}

 It has not been compiled or tested but should get you on your way.

 

BTW, there is a lot of ActionScript, Adobe Flex and Adobe AIR examples on the web for basic use of controls and events.

 

Good luck.

 

 

Developer
ddluk
Posts: 212
Registered: ‎10-02-2010
My Device: Z10 and Z30

Re: How to get TextInput value

Thank you John. I was trying all day someting like:

 

text_input.text = "something";

 

But it never works. Developing in Air is for me something new so I'm trying to do my best but sometimes I've got problems. Maybe you now some good websites with informations about Adobe Air programming?

Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: How to get TextInput value

There are a lot of website, sample codes and blogs all over.

 

Just do searched for "Adobe Flex" or "Adobe AIR" or "Action Script" as a prefix to what ever you are looking for.  That has always helped me.

 

Worse case, ask here.  Community has been very helpful on this forum.

 

Dont forget to give Kudos (white star) when ever possible: :smileywink: