发送从JavaScript来动作IE浏览器问题 [英] send from javascript to actionscript IE problem

查看:265
本文介绍了发送从JavaScript来动作IE浏览器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从一个HTML页面发送一个字符串(使用JavaScript)SWF文件(动作脚本2)。

I tried to send a string from an html page (with javascript) to a swf file (action script 2).

我搜索在谷歌,发现此页面

但例如code(第1版,而不是2,你可以找到它的源文件的.zip)在IE浏览器没有工作(IE表示:对象不支持此属性或方法)

but the example code (version 1, not 2, you can find it in the source file .zip) didn't work in IE (IE said: object doesn't support this property or method)

哪里出了问题? (我不希望使用SWFObject的。)

where is the problem? (i don't want to use SWFObject.)

动作脚本:::

//From Evan Mullins @ circlecube.com
//View post at http://blog.circlecube.com/2008/02/01/actionscript-javascript-communication/



import flash.external.*;

//Set up Javascript to Actioscript
var methodName:String = "sendTextFromHtml";
var instance:Object = null;
var method:Function = recieveTextFromHtml;
var wasSuccessful:Boolean = ExternalInterface.addCallback(methodName, instance, method);

//Actionscript to Javascript
//ExternalInterface.call("recieveTextFromFlash", _root.theText.text);

function recieveTextFromHtml(t) {
    _root.theText.text = t;
}

_root.button.onRelease = function() {
    ExternalInterface.call("recieveTextFromFlash", _root.theText.text);
    _root.theText.text = "";
}

JS :::

js:::

function recieveTextFromFlash(Txt) {
    document.getElementById('htmlText').value = Txt;
}

和的onclick JS code :::

and the onclick js code:::

getElementById('flash').sendTextFromHtml(htmlText.value); document.getElementById('htmlText').value = ''

感谢你。

推荐答案

给这个JavaScript codea的尝试?

give this javascript code a try?

function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName]; 
}  

function addToResults(results) { getFlashMovie("flashdemo").addToResults(results); }

这篇关于发送从JavaScript来动作IE浏览器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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