模拟鼠标事件listener(new MouseEvent(MouseEvent.CLICK));

import flash.events.KeyboardEvent;

import flash.ui.Keyboard;



mc.addEventListener(MouseEvent.CLICK,listener);

stage.addEventListener(KeyboardEvent.KEY_DOWN,_keyDown);



function _keyDown(e:KeyboardEvent):void

{

	if (e.keyCode == Keyboard.SPACE)

	{

		listener(new MouseEvent(MouseEvent.CLICK));

	}

}



function listener(e:MouseEvent):void

{

	trace("鼠标点击了");

	trace(typeof(e.target));

}



你可能感兴趣的:(listener)