Javascript 和 Flash/ActionScript 之间的交互无需外部接口?
是否可以使用 Javascript 在没有外部接口的情况下单击/获取 ActionScript 值/操作?
GreaseMonkey 是这样工作的吗?我可以使用 GreaseMonkey 来做到这一点吗?
Is is possible to click/get ActionScript values/actions using Javascript without ExternalInterface?
Is the how GreaseMonkey works? Can I do that using GreaseMonkey?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
怎么样
它的
GetVariable("swfvar");
将 var 名称作为字符串
和
SetVariable("swfvar",jsval);
使用 swfvar 名称作为字符串和 js 值无论你想
执行函数,有两种方法
1. 将上面的代码与 var swf 一起使用,
swf.SwfFunc(参数);
简单吧?是的。
2.再次使用上面的代码
swf.GetVariable("SwfFunc(params)");
因为它获取了函数的值,所以它会执行所有函数来寻找返回值,如果参数很丑陋且引号重叠,则可能会很糟糕,因为
个人调用中已经有引号,我喜欢方法 2,因为它可以使用也可用于其他目的,例如执行代码。像这样
我发现这非常有用,但请记住你必须转义该函数中的引号
它实际上就像注入一个 eval 语句,但更好
how about
its
GetVariable("swfvar");
with the var name as a string
and
SetVariable("swfvar",jsval);
with the swfvar name as a string and the js value whatever you want
to execute function, there are 2 ways
1. using the code above with the var swf,
swf.SwfFunc(params);
simple, right? yes.
2.again with code above
swf.GetVariable("SwfFunc(params)");
since it gets the value of the function, it executes it all to look for a return value, might be bad if the params are ugly with overlapping quotes because there are already quotes in the call
personally, I like method 2 because it can be used for other purposes too, like executing code. like this
I find this very useful, but remember you must escape the quotes in that function
it is actually like injecting an eval statement, but better
这相当困难,但也许可以在 javascript 中实现
LocalConnection
或NetStream
直接连接(用于使用send()
方法):)另一种方法是使用某些东西作为缓冲区,SWF 和 javascript 每隔一定时间都会检查它。一个简单的 php 脚本将是一个很好的缓冲区,也可能此数据可以存储在浏览器地址栏中
#
另一个有趣的想法是:您可以开发一个 SWF 信使程序,每次您需要向 Flash 传递消息时都会加载该信使程序。消息作为获取变量传递给信使,它将使用主 swf 创建一个
LocalConnection
并在那里传递数据。但从 flash 调用 js 的唯一方法是navigateToURL
或sendToURL
it's rather hard but maybe possible to implement
LocalConnection
orNetStream
direct connection (for using thesend()
method) in javascript :)the other way is to use something as a buffer that'll be checked by SWF and javascript every certain time. A simple php script will be a good buffer, also maybe this data could be stored in browser adress bar after
#
and another funny idea: you can develop an SWF messenger that will be loaded every time you need to pass a message to flash. message is passed to the messenger as get variables and it will create a
LocalConnection
with the main swf and pass data there. but the only way to call js from flash isnavigateToURL
or maybesendToURL