Flex利用JavaScript执行cmd命令
Flex:
//注册js事件
protected function init():void
{
ExternalInterface.addCallback("runcommand",runcommand);
}
//执行js方法
private function runcommand():void
{
ExternalInterface.call("runcommand");
}
JavaScript:(index.template.html)
//JavaScript代码
<script language="JavaScript" type="text/javascript">
function runcommand()
{
s=new ActiveXObject("WScript.Shell");
cmd="osk"; //此处调用windows自带虚拟键盘命令
s.Run(cmd);
}
</script>