플래시 무비에서 해당 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

  4 Responses to “Retrieving the URL.”

  1. 사실 니가 다 한거지. 난 거기에 살만 조금 붙였을 뿐.

  2. 와.. 간단명료하게.. 가르침 배우고 담아갑니다~

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

   
© 2011 Hangun's World - Blog Suffusion theme by Sayontan Sinha