通过 JavaScript 单击到 Flash 对象 [英] Click to Flash object via JavaScript

查看:28
本文介绍了通过 JavaScript 单击到 Flash 对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过 JavaScript 在 Flash 对象上触发点击事件?

Is it possible to trigger click event on Flash object via JavaScript?

推荐答案

是和否.您可以使用ExternalInterface 模拟您的 Flash 项目中的点击事件,前提是它们不关心事件源(即是否人类).

Yes and no. You can use the ExternalInterface to simulate click events in your Flash project, provided they don't care about the event source (i.e. human or not).

然而,Flash 中关于点击事件源的功能之一是文件选择对话框.如果没有来自真实用户的真正点击(就浏览器而言),就不可能触发它;如果可能的话,这实际上是一个潜在的安全风险.如果我没记错的话,这在 FP 9 之前是可能的,我们为我们的文件上传器利用了这种行为.一旦他们修复它,这开始引起问题,但我很高兴他们这样做了:)

However, one of the features in Flash that's particularly obtuse about the click event source is the File Selection dialog. It's not possible to trigger that without a real click from a real user (as far as the browser is concerned); this would actually be a potential security risk if possible. If I remember correctly, this was possible before FP 9 and we exploited this behavior for our file uploader. This started to cause issues once they fixed it, but I'm glad they did so :)

克服此限制的典型方法是创建一个透明的 Flash 对象并在其上放置一个显示按钮图像的图层;点击事件最终会命中 Flash 对象并触发用户点击事件.

The typical way to overcome this limitation is by creating a transparent Flash object and positioning a layer over it that shows a button image; the click event will eventually hit the Flash object and trigger a user click event.

这篇关于通过 JavaScript 单击到 Flash 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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