发送键盘和鼠标事件,以Flash动画鼠标、键盘、事件、动画

2023-09-08 11:32:18 作者:最近经常熬夜,我的肝好像不太好,大家可以叫我小心肝吗?今日小

我在寻找一种方式来注入某些事件成在浏览器中运行的Flash影片。我知道动作的ExternalInterface.addCallback功能,但是我想从网络的任何随机闪存来实现这一点。例如。发送SPACE键盘事件到YouTube的视频。

I'm looking for a way to "inject" some events into a flash movie running on a browser. I know about ActionScript's ExternalInterface.addCallback function, however I'm trying to achieve this with any "random" flash from the web. Eg. send a "SPACE" keyboard event to a youtube video.

推荐答案

您不能这样对任何随机的swf,因为安全性限制,任何网站。你需要有访问DOM,只能由的Javascript注射做,除非你是一个与SWF嵌入到网站,与的allowScriptAccess =总是在HTML模板。 MySpace上,例如,可以让你任何随机的swf添加到HTML页面,但你不能这样做,JavaScript的东西,因为他们强迫的allowScriptAccess 永远是(除其他事项外),以prevent任何JavaScript / DOM访问。

You can't do this to any random swf on any website because of security limitations. You need to have access to the DOM, which can only be done by Javascript Injections, unless you are the one with the swf embedded in the site, with allowScriptAccess="always" in the html template. MySpace, for example, allows you to add any random swf to the html page, but you can't do that javascript stuff because they force allowScriptAccess to always be false (among other things) to prevent any javascript/dom access.

如果这仅仅是为你做出你自己的生活更轻松浏览时,您可以使用萤火火狐。看看这个JQuerify小书签和视频,黑客与Digg的萤火虫和jQuery 。这表明你如何动态地修改使用JavaScript的网页的,而这些命令保存为快捷方式!超爽。

If this is just for you to make your own life easier while browsing, you can use Firebug for Firefox. Check out this JQuerify Bookmarklet and Video, Hacking Digg with Firebug and JQuery. It shows you how to dynamically modify the webpage your on using javascript, and save those commands as shortcuts! Super cool.

所以,你可以节省JQuerify命令,如:

So you could save a JQuerify command like:

$(#youtube_player)发挥();

......或任何API是启动一个YouTube视频在他们的HTML页面,如果这甚至有可能。

...or whatever the api is for starting a youtube video in their html page, if that's even possible.

希望帮助, 兰斯

 
精彩推荐
图片推荐