Hi
Desperately need help and would be gretaful if someone could see if they can find what is wrong.
I am trying to trigger a swf movie embedded in web page by using a js function.
This is a dry run using sample code I have found, i eventually just want the movie to play and stop via js instructions, when clicking an a href.
Website is http://simplywebdzine.com/ASJS_test.html
The as3 code in the swf is:
import flash.external.ExternalInterface;
ExternalInterface.addCallback("sendTextToFlash", getTextFromJavaScript);
function getTextFromJavaScript(str):void {
trace(str);
}
THANK YOU
Adding full HTML :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function setCurrentPage(newPage) {
currentPage = newPage;
SendDataToFlashMovie(newPage);
}
function getFlashMovieObject(movieName){
if (window.document[movieName]){
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1){
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else{
return document.getElementById(movieName);
}
}
function SendDataToFlashMovie(newPage){
var flashMovie=getFlashMovieObject("myFlashMovie");
flashMovie.sendTextToFlash(newPage);
}
</script>
</head>
<body>
<a href="#" onClick="setCurrentPage('Home')">Home</a>
<object height="250" width="380" id="myFlashMovie"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash
/swflash.cab#version=8" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param value="myFlashMovie.swf" name="movie">
<param value="high" name="quality">
<param value="transparent" name="wmode">
<param value="#FFFFFF" name="bgcolor">
<param value="true" name="allowFullScreen">
<param value="true" name="swLiveConnect">
<param value="always" name="allowScriptAccess">
<embed height="250" align="middle" width="380" src="myFlashMovie.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer" play="false"
loop="false" scale="showall" wmode="transparent" devicefont="false"
bgcolor="#000000" menu="true" allowfullscreen="false" allowscriptaccess="always"
salign="" type="application/x-shockwave-flash" name="myFlashMovie">
</object></body>
</html>