通过javascript触发Flash按钮对象 [英] Trigger flash button object via javascript

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

问题描述

是否有可能通过JavaScript触发例如Flash上​​传按钮?



例如,我做了空图像包装,点击它们,他们触发闪光灯按钮打开为选择窗口。



谢谢!

解决方案

在你的SWF中有一个flash函数,就像这样:

$ $ $ $ $ $
$ my $
{
//做一些有用的事情
}

在包含SWF的页面中将其暴露给JavaScript:

  // swf 
中的AS3代码ExternalInterface。 addCallback(myfunction,myfunction);

然后从JavaScript中,您可以这样调用它:

  //浏览器中的JavaScript代码
var swf = window.getElementById(myswf);
swf.myfunction();

在你的情况下,你可以调用你想从myfunction()运行的代码。


Is it possible to trigger for example flash uploading button via javascript?

For example I have made empty image wrappers and by clicking on them, they trigger flash button to open as select window.

Thanks!

解决方案

Assuming you have a flash function in your SWF, like this:

// AS3 code in swf
function myfunction():void
{
    // Do something useful
}

You can expose it to JavaScript in a page that contains your SWF like this:

// AS3 code in swf
ExternalInterface.addCallback("myfunction", myfunction);

Then from JavaScript you can call it like this:

// JavaScript code in browser
var swf = window.getElementById("myswf");
swf.myfunction();

In your case you can invoke the code you want to run from myfunction().

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

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