[thelist] Flash calling Javascript

Norman Beresford n.beresford at anansi.co.uk
Wed Aug 10 04:05:56 CDT 2005

Hi all

I've got a real pita Flash problem at the moment and I was hoping
someone on here could point me in the direction of solving it.

I have an HTML page, which has a div containing a Flash movie.  There's
a couple of javascript functions on the page which either resize the div
so that it disappears, or simply sets it's visibility to false.  The
Flash movie runs and when it's finished running it's supposed to call
the javascript function so that it disappears.  As a test I've added a
button to the page which calls either function.

The problem is quite simple.  In Firefox clicking the button will make
the movie disappear, and letting the Flash movie run will make it
disappear.  In IE 6.0 clicking the button will make the movie disappear,
but if I just let the movie run it won't.  It seems that the movie won't
call the function in IE.  I've tried using both
getURL("javascript:ResizeFlashMovie()"); and
fscommand(ResizeFlashMovie); and while both work in FF neither works in

Does anyone have any pointers?  Various bits of code follow.


The HTML for the div and flash movie

<div id="flashDiv" style="width:500px; height:500px">
			<OBJECT id="rip_final03"
				height="100%" width="100%"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" VIEWASTEXT>
				<PARAM NAME="_cx" VALUE="7673">
				<PARAM NAME="_cy" VALUE="9260">
				<PARAM NAME="FlashVars" VALUE="">
				<PARAM NAME="Movie"
				<PARAM NAME="Src"
				<PARAM NAME="WMode" VALUE="Window">
				<PARAM NAME="Play" VALUE="0">
				<PARAM NAME="Loop" VALUE="-1">
				<PARAM NAME="Quality" VALUE="High">
				<PARAM NAME="SAlign" VALUE="">
				<PARAM NAME="Menu" VALUE="-1">
				<PARAM NAME="Base" VALUE="">
				<PARAM NAME="AllowScriptAccess"
				<PARAM NAME="Scale" VALUE="ShowAll">
				<PARAM NAME="DeviceFont" VALUE="0">
				<PARAM NAME="EmbedMovie" VALUE="0">
				<PARAM NAME="BGColor" VALUE="99FF00">
				<PARAM NAME="SWRemote" VALUE="">
				<PARAM NAME="MovieData" VALUE="">
				<PARAM NAME="SeamlessTabbing" VALUE="1">
				<EMBED src="rip_final03.swf"
quality="high" bgcolor="#99FF00" WIDTH="100%" HEIGHT="100%"
NAME="rip_final03" ALIGN="" TYPE="application/x-shockwave-flash"

The javascript functions:

function rip_final03_DoFSCommand(strCommand, strArgs)
		function hideDiv(pass) {
			var divs = document.getElementsByTagName('div');
				if(divs[i].id.match(pass)){//if they are
'see' divs
					if (document.getElementById) //
DOM3 = IE5, NS6
divs[i].style.visibility="hidden";// show/hide
						if (document.layers) //
Netscape 4
document.layers[divs[i]].display = 'hidden';
						else // IE 4
document.all.hideShow.divs[i].visibility = 'hidden';
		function ResizeFlashMovie()
		function setFlashWidth(divid, newW){
			document.getElementById(divid).style.width =
		function setFlashHeight(divid, newH){
			document.getElementById(divid).style.height =
		function setFlashSize(divid, newW, newH){
			setFlashWidth(divid, newW);
			setFlashHeight(divid, newH);

More information about the thelist mailing list