i need help calling a javascript function from flash, i have embedded the flash using swfobject, heres my javascript to embedd it
<script type="text/javascript">
swfobject.registerObject("myFlashContent", "9.0.0", "expressInstall.swf");
</script>
Here is my HTML which is used to show the flash
<div class="flash">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="258" id="myFlashContent">
<param name="movie" value="btnDemo.swf" />
<param name="allowscriptaccess" value="always" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="btnDemo.swf" width="258">
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
And in my flash i have, which should display a popup message
getURL("javascript:alert('hello')");
However, none of this is working.
Anyone have any ideas as to why this isn’t working?
You should really use
ExternalInterfacefor doing calls to JavaScript. Using it looks like this:Using the availability test prevents the code throwing an error when running in the IDE.
Also, in your example you are targeting FP9, so your code must be AS3? AS3 has no
getURL()method.