Link to home
Start Free TrialLog in
Avatar of Gobernaster
Gobernaster

asked on

Using Dreamweaver to get a Flash button's click action to open a "popup" in a new, resized window

I used Dreamweaver to create a Flash button that links to a slideshow I created.  I would like the button to open a new, resized window without any IE toolbars when it is clicked.

I used Dreamweaver to create an onClick action that should result in a new, resized window without toolbars.  A new window does open but it includes the toolbars and is not resized.

Here is the code that appears within my head tags:

<SCRIPT Language=JavaScript>
function MM_openBrWindow(theURL,winName,features) { //v2.0
  alert( "MM_openBrWindow has been called" );       // debugline
  window.open(theURL,winName,features);
}
//-->
</SCRIPT>

I added the debugline to see if the function is ever even activated and never received the alert.

Here is the code I am using for the Flash button:
<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="103" height="24" onClick="MM_openBrWindow('yachts.htm','yachts2','width=640,height=480')">
          <param name="BASE" value=".">
          <param name="movie" value="marine.swf">
          <param name="quality" value="high">
          <param name="bgcolor" value="#000099">
          <embed src="marine.swf" base="." quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="103" height="24" bgcolor="#000099" onClick="MM_openBrWindow('yachts.htm','yachts2','width=640,height=480')"></embed>
        </object>

This is my first experience with Flash buttons so hopefully it is just something stupid in the code I missed.

Thanks in advance!

-Scott
Avatar of klykken
klykken

The onlick statment needs to be done in actionscript from within the flash file.
Look here: http://www.macromedia.com/support/flash/ts/documents/popup_windows.htm

-klykken
The getURL:"javascript" is what you're looking for.
http://www.macromedia.com/support/flash/ts/documents/popup_windows.htm#geturljs

-klykken
Avatar of Gobernaster

ASKER

klykken,

I followed the instructions in the getURL:"javascript" link you provided and ended up with the following code in between my head tags:

<SCRIPT>

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->

function openNewWindow(URLtoOpen, windowName, windowFeatures) {
newWindow=window.open(URLtoOpen, windowName, windowFeatures); }
</script>

And the following code for my flash button:

<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="103" height="24" onClick="MM_goToURL('parent','javascript:openNewWindow('http://www.macromedia.com','thewin','height=400,width=400,toolbar=no,scrollbars=yes')');return document.MM_returnValue">
          <param name="movie" value="marine.swf">
          <param name="quality" value="high">
          <param name="bgcolor" value="#000099">
          <embed src="marine.swf" base=""  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="103" height="24" bgcolor="#000099" swLiveConnect=true NAME=marine.swf></embed>
        </object>

I am sure it is a mistake I am making, but the function still never even seems to be called.

Please help...
Yes you are making a mistake :-)

"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="103" height="24" onClick="MM_goToURL('parent','javascript:openNewWindow('http://www.macromedia.com','thewin','height=400,width=400,toolbar=no,scrollbars=yes')');return document.MM_returnValue">
"

You cannot put the javascript into the <object> tag as you've done above. You have to do it inside you *flash* file like the links I gave you describes. It is done with Actionscript which is very similar to javascript, but it runs inside the .fla file. You have to open you .fla file in Macromedia Flash to insert the onlick valies for your pop-up window.

Follow the guidlelines here exactly:
http://www.macromedia.com/support/flash/ts/documents/popup_windows.htm#geturljs

As you can see, the javascript needs to be exactly like this:
<script language="JavaScript">
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
newWindow=window.open(URLtoOpen, windowName, windowFeatures); }
</script>

And in  your Flash file, (open it in Macromedia Flash):
1. Assign the getURL action to a button or keyframe.
2. For the URL, insert the code below, copying the information exactly.

javascript:openNewWindow('yachts.html','yachts2','height=480,width=640,toolbar=no,scrollbars=yes')

Make sure it's all in one line in your input field.

-klykken

 
I figured it had to just be me.

The problem is that the button I am using is a standard button that came with DreamWeaver so what I have is the .swf file, not the actual .fla file.  That is why I was not editing it within flash...

Is there any way to add the Actionscript within DreamWeaver?
ASKER CERTIFIED SOLUTION
Avatar of klykken
klykken

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
PERFECT!!!  Thank you klykken!!!!!!  Sorry you had to work so hard for those points.
No Problem, the points amount was appropiate :-)