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

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

问题描述

是否有可能通过JavaScript触发Flash对象的点击事件?

解决方案

是和否。您可以 使用 ExternalInterface 来模拟您的点击事件Flash项目,只要他们不关心事件源(即人或不)。

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

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


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

解决方案

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).

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 :)

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天全站免登陆