forked from: forked from: テキストフィールド入力
♥0 |
Line 31 |
Modified 2011-06-17 11:44:06 |
MIT License
archived:2017-03-20 05:13:11
ActionScript3 source code
/**
* Copyright shinw ( http://wonderfl.net/user/shinw )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/c6iG
*/
// forked from xtml.css's forked from: テキストフィールド入力
// forked from shmdmoto's テキストフィールド入力
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.events.Event;
public class TextField_type extends Sprite {
private var tfResult:TextField;
private var tfInput:TextField;
public function TextField_type() {
tfResult = createTextField(10,70, 200, 20);
tfInput = createTextField(10,45, 100, 20);
tfInput.type = TextFieldType.INPUT;
tfInput.border = true;
tfInput.text = "bbb";
tfInput.addEventListener(Event.CHANGE, changeHandler);
}
private function changeHandler(e:Event):void {
tfResult.text = "aaa" + tfInput.text + "ccc";
}
private function createTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
result.background = true;
addChild(result);
return result;
}
}
}