I noticed that the Rex M answer is a bit incomplete.
He was right about using ...
import flash.external.ExternalInterface; var result:string = ExternalInterface.call("getMyVar");
Then in your javascript you can use
<script language="JavaScript"> function getMyVar() { return myVar; } </script>
However, to use this, the flash movie must be in html accessible via http. Do not use file: //
Here is a tutorial for communicating with actionscript in javascript and vice versa. http://www.youtube.com/watch?v=_1a6CPPG-Og&feature=plcp
source share