flash on 2011-5-11
♥0 |
Line 36 |
Modified 2011-05-11 01:09:24 |
MIT License
archived:2017-03-20 05:08:20
ActionScript3 source code
/**
* Copyright yashikei ( http://wonderfl.net/user/yashikei )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/1iRK
*/
package
{
import flash.display.*;
import flash.text.*;
import flash.events.*;
public class Main extends Sprite
{
private var t_in:TextField = new TextField();
private var t_out:TextField = new TextField()
public function Main()
{
//入力側テキストフィールド
t_in.text = "ここにテキストを入れます";
t_in.x = 10;
t_in.y = 10;
t_in.width = 300;
t_in.height = 20;
t_in.type = TextFieldType.INPUT;
t_in.background = true;
//TEXT_INPUTではバックスペースが取れません。
//t_in.addEventListener(TextEvent.TEXT_INPUT, OnInputCapture);
t_in.addEventListener(Event.CHANGE, OnChange);
addChild(t_in);
//出力側テキストフィールド
t_out = new TextField();
t_out.x = 10;
t_out.y = 50;
t_out.width = 300;
t_out.height = 20;
t_out.text = "こっちにリアルタイムで結果が表示されます"
t_out.background = true;
t_out.backgroundColor = 0xAAAAAA;
addChild(t_out);
}
//入力テキストフィールドに変更があったら呼ばれる
public function OnChange(e:Event):void
{
t_out.text = t_in.text;
}
}
}