PDA

View Full Version : disjointed flash rollovers in DW


svek808
12-07-2005, 04:50 PM
I would like to make a disjointed rollover, so that when the mouse is over the flash object it swaps an image in another part of the page. Is this possible?

davidj
12-08-2005, 09:23 AM
ok

copy this into an empty page .. it includes all the functions and html.
You will have to analyse it to see what it does



<!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=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x ; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onload="MM_preloadImages('images/04-cupra-badge2.jpg')">
<p><img src="images/04-cupra-badge.jpg" name="no1" width="200" height="282" id="no1" onmouseover="MM_swapImage('no2','','images/04-cupra-badge2.jpg',1)" onmouseout="MM_swapImgRestore()" />
<img src="images/04-cupra-badge3.jpg" name="no2" width="200" height="282" id="no2" /></p>
<p>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100" height="100">
<param name="movie" value="flashswap.swf" />
<param name="quality" value="high" />
<embed src="flashswap.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100" height="100"></embed>
</object>
</p>
</body>
</html>


unzip the file below and drop the images into an images directory but make sure the swf file is above the images directory (in the root)

when you run the page you should see 2 images of a car and a flash button. If you mouse over image 1 then image 2 will change. The same will happen if you mouse over the flash button which is your goal
------------------

when you create your flash button you can use the following actionscript to call javascript as..
they aint heavy....they are brothers... <_< hehe .. i crack myself up



on (rollOver) {
getURL("javascript:MM_swapImage('no2','','images/04-cupra-badge2.jpg',1)");
}
on (rollOut){
getURL("javascript:MM_swapImgRestore()");

}

i hope you understand this as i have totally confused myself :blink:

svek808
12-08-2005, 03:40 PM
I did as you said, but when I mouseover the images don't change.
I'm also confused about how to use the actionscript.
I'm sorry if I'm being dim!

Thanks alot for the help.

kate
12-08-2005, 04:41 PM
Hya,

Maybe a tutorial with text and images may help you more:

http://www.dwfaq.com/tutorials/basics/disjointed.asp ('http://www.dwfaq.com/tutorials/basics/disjointed.asp')

:)

Creative Insanity
12-08-2005, 05:15 PM
Nice tut Kate ;)

kate
12-08-2005, 08:13 PM
Hya CI,

That site is extremely popular for tutorials. easy explanations too.

I do believe congrats are in order lololol you joined admin, well done. we expect lots of stuff now you know.

:lol: :lol:

Happy Christmas to one and all at yours CI.

cya

Creative Insanity
12-08-2005, 11:32 PM
Cheers Kate and ta and the same to you and yours ;)

I think it is just because people know they can trust me.. and I like to help out.

davidj
12-09-2005, 08:35 AM
I think it is just because people know they can trust me.. and I like to help out.

especially when they PM you. hehe