memo:jsポップアップをasからよびだし
いまさらpopup!
jsとasのやりとりにjson使えたら楽なんだろうけど、
まぁ、popup自体がoldtypeですし、余計なものを入れるのはめんどくさいですね。
文字列引数でGO!
firefoxのみ動作確認済み
//js側 /*コンテンツ流し込み形式でpopupを作ってfocusまで args title:windowtitle setting:windowsetting contents:htmlstring */ function popupCreater(title,setting,contents){ // console.debug(href + title + setting + contents); //for firebug debug //ウィンドウ生成オブジェクト参照を取得 var nWin = window.open("",title,setting); nWin.document.open(); nWin.document.write(contents); nWin.document.close(); // nWin.focus(); //focusとか要らない。 return false; };
//as側 //JS呼び出しAS側 サーバー経由じゃないとだめよ。htmlを読み込んでもうまくは動きません。 //importするねー //import flash.external.ExternalInterface; // JavaScriptの実行 戻り値いらないならこれでOKかな.戻り値をもらうなら型とか気をつけなきゃですね。 ExternalInterface.call( "popupCreater", /*js's function name*/ "TitleisFromAS", /*window title for handle with js/html??? */ "width=400,height=300", /*window open option*/ "<html><body><h1>aaaaaaaaaa</h1></body></html>" /* contetns */ );
ハマリどころはhtmlをファイルプロトコルで読んでも幸せになれないな、ってこと
apatcheに載せましょうね。