使用JavaScript在Flash中模拟鼠标点击 [英] Simulate a mouse click in Flash using JavaScript

查看:188
本文介绍了使用JavaScript在Flash中模拟鼠标点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我正在为网站开发Greasemonkey脚本。我不控制Flash文件。

Background: I'm developing Greasemonkey scripts for a website. I do not control the Flash file.

问题:是否可以模拟鼠标点击Flash对象中的按钮/影片剪辑嵌入在一个网页? Google仅显示模拟鼠标点击DOM元素的方法,以及需要更改ActionScript以实现JavaScript界面​​的方法。或者,这是不可能的?

Question: Is it possible to simulate a mouse click on a button/movie clip in a Flash object embedded in a web page? Googling only shows ways to simulate a mouse click on a DOM element, and ways that require the ActionScript to be changed to implement a JavaScript interface. Or is this simply impossible?

推荐答案

这是不可能的,除非SWF实现ExternalInterfaces并打开一个函数从Javascript调用允许它访问_root。即便如此,SWF必须有方法来允许调用onclick事件。最好的办法是点击object元素,因为Javascript没有一个方法来模拟特定的(x,y)点击

It's not possible unless the SWF implements ExternalInterfaces and opens up a function to be called from Javascript to allow it access to the _root. Even then, the SWF has to have methods inside it to allow calling onclick events. The best you can do is clicking on the object element because Javascript doesn't have a method for simulating a click at a specific (x, y)

这篇关于使用JavaScript在Flash中模拟鼠标点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆