• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 634
  • Last Modified:

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.  
0
marcdtucker
Asked:
marcdtucker
  • 7
  • 4
1 Solution
 
DesignbyonyxCommented:
Can you post some code or a url?  No such thing as too much info... sort of.

~Ryan
0
 
marcdtuckerAuthor Commented:
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)
0
 
DesignbyonyxCommented:
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
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
marcdtuckerAuthor Commented:
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>
0
 
DesignbyonyxCommented:
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

0
 
marcdtuckerAuthor Commented:
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.
0
 
DesignbyonyxCommented:
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
0
 
DesignbyonyxCommented:
scratch that... I see it now... I'll get back to you.
0
 
DesignbyonyxCommented:
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
0
 
marcdtuckerAuthor Commented:
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.
0
 
DesignbyonyxCommented:
If you look at the code in your html file, for each button that you are assigning a behavior, you will see an "onfocus" event assigned to your flash buttons.  This is the code that is being generated by the "Behaviors" panel.  All you need to do is copy the "onfocus" action for each movie clip (yes, this means you will actually have to look at code), copy it, and paste it in your root timeline in flash.  You must then wrap it in an onRelease event INSIDE flash, see example below:

... or you can fight with Adobe or Mozilla.  The solution below should take you only minutes... your choice.

ps. If you want to do web design, you must learn to look at code.
pss. If you want to use interactive flash in your design, you must learn to look at code
this.onRelease = function():Void {
     getURL("javascript:MM_showHideLayers('apDiv24','','hide','apDiv21','','hide','apDiv20','','hide','apDiv19','','hide','apDiv18','','hide','apDiv17','','hide','apDiv16','','hide','apDiv15','','show','apDiv14','','hide','apDiv13','','hide')");
}
 
/* You can use this as a template
this.onRelease = function(){
     getURL("javascript:[Insert Code Here - Remove Brackets]");
}

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now