1
HTMLページ(JavaScript付き)からswfファイル(アクションスクリプト2)に文字列を送信しようとしました。javascriptからactionscript IE問題
Googleで検索したところ、this pageが見つかりました。 (ソースファイルの.zipファイルでそれを見つけることができ、バージョン1ではなく2、)
が、例のコードは、IEで動作しませんでした(IEは言った:オブジェクトはこのプロパティまたはメソッドをサポートしていません)
問題はどこだ? (私は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 :::
function recieveTextFromFlash(Txt) {
document.getElementById('htmlText').value = Txt;
}
とonclickのjsのコード:::
getElementById('flash').sendTextFromHtml(htmlText.value); document.getElementById('htmlText').value = ''
ありがとうございます。