StageText - 如何使用多个StageText字段?

时间:2013-04-20 16:41:11

标签: mobile air flash-cs6

我正在使用Flash CS 6和Air 3.6来构建Android应用。 我想将StageText用于输入字段。 以下代码仅适用于第一个文本字段。我需要更改什么才能使它适用于两个文本字段?

// NO. 1
var firstfield:StageText = new StageText(); 
firstfield.softKeyboardType = SoftKeyboardType.DEFAULT
firstfield.stage = foobar.stage
firstfield.viewPort = new Rectangle(foobar.x, foobar.y, foobar.width, foobar.height); 

// NO. 2
var secondfield:StageText = new StageText(); 
secondfield.softKeyboardType = SoftKeyboardType.DEFAULT
secondfield.stage = example.stage
secondfield.viewPort = new Rectangle(example.x, example.y, example.width, example.height); 

1 个答案:

答案 0 :(得分:-1)

尝试这样的事情:

var firstfield:StageText = new StageText(); 
firstfield.softKeyboardType = SoftKeyboardType.DEFAULT
firstfield.stage = this.stage;
firstfield.viewPort = new Rectangle(0, 0, 200, 30);
firstfield.x = 0;
firstfield.y = 0;
firstfield.width = 200;
firstfield.height = 30;
addChild(firstfield); 

var secondfield:StageText = new StageText(); 
secondfield.softKeyboardType = SoftKeyboardType.DEFAULT
secondfield.stage = this.stage;
secondfield.viewPort = new Rectangle(0, 40, 200, 30);
secondfield.x = 0;
secondfield.y = 40;
secondfield.width = 200;
secondfield.height = 30;
addChild(secondfield);