Monday, May 18, 2009

TextFieldType.INPUT;

A nice way to collect input from a user and then do what you want with it (i.e. use it for Twitter Search). The key is TextFieldType.INPUT
public function Twitter()
{
mText.x= 240;
mText.y= 0;
mText.width = 200;
mText.text = "Your momma and stuff";
this.addChild(mText);

theTextField.type = TextFieldType.INPUT;
theTextField.border = true;
theTextField.x = 10;
theTextField.y = 10;
theTextField.multiline = true;
theTextField.wordWrap = true;
addChild(theTextField);

var sprite:Sprite = new Sprite();
sprite.graphics.beginFill(0xcccccc, 0.5);
sprite.graphics.lineStyle(1, 0x000000);
sprite.graphics.drawCircle(0, 0, 30);
sprite.x = 50;
sprite.y = 150;
sprite.addEventListener(MouseEvent.CLICK, showText);
this.addChild(sprite);
}
public function showText(e:Event):void
{
mText.text = theTextField.text;
}

0 comments: