十一 242008
 

很简单,不过因为KeyboardEvent这个事件不是很常用,而常常会去找TextEvent里怎么判断(也许只有我会这样干~-_-!),呵呵。

package
{
	import flash.text.TextField;
	import flash.events.KeyboardEvent;
	import flash.ui.Keyboard;
	/**
	 * ...
	 * @author Dada
	 */
	public class EnterTest
	{

		public function EnterTest()
		{
			(txtKeyWord
			 as TextField).addEventListener(
			KeyboardEvent.KEY_DOWN,trackEnter);
		}

		private function trackEnter(
			kevent:KeyboardEvent):void
		{
			if (kevent.keyCode == Keyboard.ENTER)
			{
				trace("按下回车了");
			}
		}

	}

}

  4 Responses to “如何用AS3抓取回车”

  1. 很简单也很实用!做个记号!

  2. 飘过~~~ 去看灰机~~

  3. @KFO
    哪有灰机?

  4. 388442 203452I genuinely got into this post. I identified it to be intriguing and loaded with exclusive points of interest. I like to read material that makes me feel. Thank you for writing this wonderful content material. 627587

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>