【问题标题】:call external javascript function from mxml从 mxml 调用外部 javascript 函数
【发布时间】:2015-03-02 22:07:44
【问题描述】:

我是 Flash 新手。但我对我在做什么有一些了解。 我正在开发一个应用程序,我需要在我已添加到 html 文件中的外部 js 文件中传递单击按钮的值。 (html文件嵌入flash src)。

MXML 代码(函数):

private function sendDTMF(tone:String):void {
        JSLog.debug("Sending DTMF tone "+tone);
        ExternalInterface.call("sendDTMF",tone);
        //connectionManager.sendDTMF(tone);
        JSLog.debug("last Send DTMF tone "+tone);

    }

这个函数正在工作,但是当我调用这个函数并将参数传递给函数时,函数让我登录控制台。但是没有从mxml文件中调用javascript函数。

我还在 JS 文件中添加了用于外部接口和 JS 函数的库。

【问题讨论】:

    标签: javascript actionscript-3 flash apache-flex mxml


    【解决方案1】:

    你可以像这样从 Flex 调用 JS 函数

    在 AS3 中

    if(ExternalInterface.available){
    ExternalInterface.call(“openNotes”, parameter);
    }
    

    在 Javascript 中

    function openNotes(notesUrl){
    window.open(notesUrl, ”, ‘width=1000,height=600′);
    }
    

    【讨论】:

      猜你喜欢
      • 2011-12-17
      • 2014-10-01
      • 2019-12-13
      • 2011-07-05
      • 1970-01-01
      • 1970-01-01
      • 2018-04-22
      • 2013-01-12
      • 2012-11-20
      相关资源
      最近更新 更多