플래시 무비에서 해당 SWF 파일을 포함하는 HTML 문서의 URL을 구하려면, HTML 문서에서 설정을 해주어야 합니다. FlashVars 파라메터 또는 자바스크립트를 통해서 플래시 무비로 URL을 전달해 줘야 하죠. 그런데 플래시의 ExternalInterface API와 자바스크립트의 eval() 함수를 이용하면, 그럴 필요가 없습니다.
To retrieve the HTML document’s URL in which the SWF file is inserted, you have to modify the HTML document. Pass the URL to the SWF movie via an FlashVars parameter or a JavaScript function. But, the ExternalInterface API in Flash and eval() function in JavaScript provide you with a more simple solution.
SWFファイルが含まれているHTMLドキュメントのURLを得るためには、そのHTMLファイルに何か設定をしなければならない。FlashVarsパラメタとかJavaScriptを使ってフラッシュムービーにURLを伝達します。でも、フラッシュのExternalInterface APIと共にJavaScriptのeval()函数を使用すると、その必要はないんです。
1 2 3 4 5 6 7 8 9 10 11 | var btn:Button; for(var i:uint=1; i<=3; i++){ btn = this["b" + i]; btn.addEventListener(MouseEvent.CLICK, clickListener); } function clickListener(e:MouseEvent):void{ btn = e.currentTarget as Button; var str:String = ExternalInterface.call("eval", btn.label); tf.text = str; } |
Related link: http://wooyaggo.tistory.com/163
Recent Comments