flash on 2010-4-13
/**
* Copyright kihon ( http://wonderfl.net/user/kihon )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/b8zj
*/
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
public class Main extends Sprite
{
private var tf:TextField;
private var stf:TextField;
public function Main()
{
tf = new TextField();
tf.defaultTextFormat = new TextFormat("_typeWriter", 60, 0x0, true);
tf.text = "0123456789";
tf.autoSize = TextFieldAutoSize.LEFT;
addChild(tf);
stf = new TextField();
stf.defaultTextFormat = new TextFormat("_typeWriter", 60, 0x0, true);
stf.text = "";
stf.autoSize = TextFieldAutoSize.LEFT;
stf.y = 200;
addChild(stf);
tf.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
}
private function onMouseMove(event:MouseEvent):void
{
stf.text = "開始:" + tf.selectionBeginIndex +
",終了:" + tf.selectionEndIndex;
}
}
}