Link to home
Start Free TrialLog in
Avatar of marcdtucker
marcdtucker

asked on

Flash Behaviors not working in Firefox

After inserting a flash button in dreamweaver CS3  (Insert>common>flash>button) I select add behavior and then show/hide elements.  I can have any number of drawing divs on the page.  I hide all but one I show.  No matter which one I show the button does not work.  Nothing happens.  No hide no show in Firefox.  IE no problem.  Everything works in IE 6 IE7.  Nothing happens in Firefox.  
Avatar of Designbyonyx
Designbyonyx
Flag of United States of America image

Can you post some code or a url?  No such thing as too much info... sort of.

~Ryan
Avatar of marcdtucker
marcdtucker

ASKER

The problem is easy to duplicate if you are using dreamweaver cs3.  Create a blank html page add a flash button from insert>common>flash.  Add two drawing divs with any text.  Highlight the button you created and look at the tag panel.  Select the Behavior tab > select on click or on focus > select the add (+) >select show-hide elements and hide one of the divs and show the other save and browse.  Works with IE not FireFox (at least version 3.0.4)
well I don't have CS3 on my work computer, but I could probably troubleshoot it if I saw the code.  Does Dreamweaver 8 have this functionality?  I usually hand code operations like this, and had no idea dreamweaver could do this.  Any how, past the source code of your html file.  If you see any generated <script type="text/javascript" src="somefile.js">  tags, be sure to include the code from "somefile.js"

Thanks.
~Ryan
Thanks Designbyonyx:
Here is the code.
<!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 src="DWConfiguration/ActiveContent/IncludeFiles/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
#apDiv1 {
      position:absolute;
      left:80px;
      top:136px;
      width:86px;
      height:86px;
      z-index:1;
}
#apDiv2 {
      position:absolute;
      left:229px;
      top:136px;
      width:102px;
      height:88px;
      z-index:2;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
</script>
</head>

<body onload="MM_showHideLayers('apDiv1','','show','apDiv2','','hide')">
<div id="apDiv1">Hide</div>
<div id="apDiv2">Show</div>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height','22','src','test','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','test' ); //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=5,0,0,0" width="100" height="22">
  <param name="movie" value="test.swf" />
  <param name="quality" value="high" />
  <embed src="test.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="22" ></embed>
</object>
</noscript>
</body>
</html>
A couple things...

I don't recommend using Dreamweaver to assign mouse event functions to an embedded object.
But with that said, your behavior seems to be assigned to the body onload event... I don't see any way the flash button is triggering this show/hide behavior.  Do you have live example? if not could you upload one?  

The real way you should be doing this is by calling Javascript functions from within flash.
In your flash movie, assign a click or release event to your button and in the event function use code like:

// assuming AS2
getURL("javascript: MM_showHideLayers('apDiv1','','show','apDiv2','','hide')");

You can also troubleshoot the javascript by inserting some alert() calls in side the MM_showHideLayers function, just to verify the function is being called.  Then you could start alerting variables...

Copy and paste the code below to replace yours.  I have inserted some javascript alerts... let me know what happens when you use it...


~Ryan


<!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 src="DWConfiguration/ActiveContent/IncludeFiles/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
#apDiv1 {
      position:absolute;
      left:80px;
      top:136px;
      width:86px;
      height:86px;
      z-index:1;
}
#apDiv2 {
      position:absolute;
      left:229px;
      top:136px;
      width:102px;
      height:88px;
      z-index:2;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_showHideLayers() { //v9.0
  alert("FooBar");
  var i,p,v,obj,args=MM_showHideLayers.arguments;
alert("Num Arguements (Should be 6): "+ args.length);
  for (i=0; i<(args.length-2); i+=3)
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2]; alert("Trying to Show/Hide Div: "+ args[i]);
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
</script>
</head>
 
<body onload="MM_showHideLayers('apDiv1','','show','apDiv2','','hide')">
<div id="apDiv1">Hide</div>
<div id="apDiv2">Show</div>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','100','height','22','src','test','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','test' ); //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=5,0,0,0" width="100" height="22">
  <param name="movie" value="test.swf" />
  <param name="quality" value="high" />
  <embed src="test.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="22" ></embed>
</object>
</noscript>
</body>
</html>

Open in new window

for a live example go to www.csgtech.com/test/keh
press the about us button and then any of the buttons on that page and you will see it work in ie but not firefox.
Seems to be working on my end... although Im not sure what I should be looking for.  In both FF 3.0.4 and IE 7 I get the same thing... click for click.  What should I be looking for?

By the way, what you are doing is what I consider to be the hard way.  Your site is going to be virtually invisible to search engines, and you are using flash to perform functions that can easily be accomplished with images.

Also, visit the site on a wide 23 inch monitor, your content is falling behind your navigation.  I assume you have a position:absolute somewhere it shouldn't be.

~Ryan
scratch that... I see it now... I'll get back to you.
dude... I've spent an hour looking at this.  I hate to say this but you have chosen one of the most convoluted ways of doing this I have ever seen.  I could go on and on... w3c standards, accessibility, poor naming conventions, but  I know you probably don't want to hear that.  So I'll give you this- Firefox isn't firing a focus or click event for your flash movies.  Like I said before, you need to be calling these functions from within flash.  I guarantee it will work, you can call javascript directly from flash- this is the way to go.  If you do not want to look at any code, then you are going to have to use images instead of flash buttons. Sorry.

~Ryan
Thank you for your help on this subject. I do appreciate your efforts.  I will see if Mozilla or Adobe can assist with this problem.  Perhaps there is a patch that will solve the mystery as to why Mozilla Firefox does not trigger on Behavior Events via Dreamweaver CS3>Insert>Common>Flash Buttons.
ASKER CERTIFIED SOLUTION
Avatar of Designbyonyx
Designbyonyx
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial