从JavaScript传递变量闪光 [英] Passing variable from javascript to flash

查看:87
本文介绍了从JavaScript传递变量闪光的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个闪光的音乐播放器,我想通过一个按钮点击一个网站,以接受一个参数。我想我可以用JavaScript做到这一点,但不知道如何。

I have a flash music player that I would like to accept a parameter via a button click on a website. I'm thinking I could do this with javascript but not sure how.

没有任何人有任何样本code为JavaScript的,我会用它来请求变量中我的动作code是什么?

Does anybody have any sample code for both the javascript and what I would use to request the variable inside my actionscript code?

谢谢,我AP preciate了!

Thanks, I appreciate it!

推荐答案

http://painteddigital.com/2008/calling-flash-as3-functions-from-javascript/

在闪光灯添加一个回调的javascript函数:

In the flash add a callback for the javascript function:

import flash.external.ExternalInterface;
ExternalInterface.addCallback("sendTextToFlash", getTextFromJavaScript);
function getTextFromJavaScript(str):void {
    trace(str);
}

在HTML / JS调用它:

In the html/js call it:

<script type="text/javascript">
    var currentPage="Home";
    function setCurrentPage(newPage) {
        currentPage = newPage;
        SendDataToFlashMovie(newPage);
    }

JS调用功能在Flash:的getURL(JavaScript的:MyFunction的(););

Calling JS Function From Flash: getURL("javascript:myfunction();");

这篇关于从JavaScript传递变量闪光的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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