有没有一种方法调用从ExternalInterface的一个Javascript类的方法? [英] Is there a way to call a Javascript class method from ExternalInterface?

查看:203
本文介绍了有没有一种方法调用从ExternalInterface的一个Javascript类的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以调用JS函数 ExternalInterface.call('的​​func_name'。参数)。确定

I can call JS functions with ExternalInterface.call('func_name',.args). OK

但是,如果我想调用一个JS类实例的方法呢?

But what if I would like to call a js class instance method instead?

ExternalInterface.call('obj.method_name',.args) //this seems not to work

有没有办法做这件事的?

Is there any way of doing it?

推荐答案

这是范围只是迟早的问题。你必须实例化的JS类的外部SWF对象。然后,我可以参考它在 ExternalInterface.call()

It was only a matter of scope. You must instantiated the swf object outside the js class. Then I can reference it in ExternalInterface.call().

window.addEvent('domready',function(){

    swf = new Swiff('../files/swf/italy.swf',{
        id:'italy',
        container:'italy-flash',
        width:280,
        height:323,
        params:{
            bgcolor:'#ffffff',
            wmode:'opaque',
            allowScriptAccess:'always'
        }
    });

    rm = new RelessersManager('regions');

});

现在从SWF我可以调用 RM 的方法。 :) (电话('rm.method_name',...... PARAMS)) previously,我建在 RM 瑞士法郎,所以没有办法引用 RM 从SWF。

Now from the swf I can call the rm methods. :) (.call('rm.method_name',...params)) Previously, I built the swf inside rm, so there was no way to reference rm from the swf.

这篇关于有没有一种方法调用从ExternalInterface的一个Javascript类的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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