19 April 2009 ~ 0 Comments

Javascript call ActionScript

Just to share my finding on how to let javascript communicate with actionscript and vice versa. The complete source can be downloaded from here. However I will highlight some important lines.



Make sure the above lines are inserted within your <head> tags. The script file AC_RunActiveContent.js may be changed depending on where you store the file. The path can be absolute path/url or relative path to your web root folder.

	var flash_ID = "External_AS3";

Next the value of flash_ID must match with your flash ID as defined in line 82. In this example, “External_AS3″ is defined as the flash ID.

			'id', 'External_AS3',

Well, that’s all you need to do. Finally, verify using your browser. This sample has been tested working on Firefox, IE7, and Safari.

I hope this post helpful and feel free to feedback for any unsual encounter. Btw, all credits for this script goes to the following site. :)

Leave a Reply

Spam protection by WP Captcha-Free