views:

319

answers:

2

Greetings, I am trying to make my flash button to execute a javascript function. I already did alot of searching and came to a conclusion to use ExternalInterface.call. I also make the allowScriptAccess" to "always" but still it doesn't work. Here is my flash call:

import flash.external.*;
......................

function rpress() {
    ExternalInterface.call("showMessage");  
}

And this is how I embedded the flash file to my html: (sorry for the length already)

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>harita</title>
<script language="javascript">AC_FL_RunContent = 0;
function showMessage(){
alert("hey");
}

</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
</head>
<body bgcolor="#18658c">
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<script language="javascript">
    if (AC_FL_RunContent == 0) {
     alert("This page requires AC_RunActiveContent.js.");
    } else {
     AC_FL_RunContent(
      'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0',
      'width', '750',
      'height', '420',
      'src', 'harita',
      'quality', 'high',
      'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
      'align', 'middle',
      'play', 'true',
      'loop', 'true',
      'scale', 'showall',
      'wmode', 'window',
      'devicefont', 'false',
      'id', 'harita',
      'bgcolor', '#18658c',
      'name', 'harita',
      'menu', 'true',
      'allowFullScreen', 'false',
      'allowScriptAccess','always',
      'movie', 'harita',
      'salign', ''
      ); //end AC code
    }
</script>
<noscript>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="750" height="420" id="harita" align="middle">
    <param name="allowScriptAccess" value="always" />
    <param name="allowFullScreen" value="false" />
    <param name="movie" value="harita.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#18658c" /> <embed src="harita.swf" quality="high" bgcolor="#18658c" width="750" height="420" name="harita" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
</noscript>
</body>
</html>
A: 

Does you like to call a javascript function from a different domain?

stoimen
hello, from the same domain. (as in above)
Well it depends on the version of actionscirpt youre using. If it's v2 you can call getURL('javascript:someFunc()'); and that's the way you'll call the js funciton, but if you're using as3 you should do ExternalInterface('someFunc');
stoimen
A: 

Try changing

'allowScriptAccess','always',

to

'allowscriptaccess','always',

If that doesn't work, try skipping the use of AC_RunActiveContent.js and test with the code in the <noscript> tags. Sometimes I've seen AC_RunActiveContent munch on tags

Josh