...

View Full Version : mm_swapimage arguments definition



mik-nik
07-22-2010, 02:10 AM
Hope you can help.

I'm currently building a website and trying to integrate a javascript image 'tranisition' effect into mm_swapimage and failing. My knowledge of Javascipt is limited but without knowing the 'arguments' for mm_swapimage, it's impossible (looks similar to vb, but can't find an answer anywhere)

I want the effect to work on a 'timed' event rather than 'OnMouseOver' so have added script to change that (which is probably the issue!) I can get both to work idependantly but not together.

I've simplified the page and pasted the code below, as it stands the 'effect' works, but it only uses the primary image, not the other image in the array.

I'm using DW CS4 and the transition extension is called FlevOOware.

Thanks

Michael



<!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 type="text/javascript">
<!--

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_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 flvFSTI4(){//v1.01
this.style.filter="";}

function flvFSTI3(v1,v2){//v1.01
var v3;if (v1.filters[0]&&v1.filters[0].status==2){v1.filters[0].Stop();}if (v2==0){v3="blendTrans(Duration="+v1.STI8+")";}else {v3="revealTrans(Duration="+v1.STI8+",Transition="+(v2-1)+")";}v1.style.filter=v3;}

// Wipe Right Out
function flvFSTI2(){//v1.01
var v1,v2=document,v3=v2.STI4,v4;for (v4=0;v3&&v4<v3.length&&(v1=v3[v4])&&v1.STI5;v4++){if (v1.filters&&!v2.STI7){flvFSTI3(v1,v1.STI3);v1.filters[0].Apply();}v1.src=v1.STI5;if (v1.filters&&!v2.STI7){v1.filters[0].Play();}}}

// Wipe Right In
function flvFSTI1(){//v1.01
// Copyright 2003, Marja Ribbers-de Vroed, FlevOOware (www.STI1.nl/dreamweaver/)
var v1=arguments,v2=document,v3;v2.STI4=new Array();v2.STI7=(navigator.userAgent.toLowerCase().indexOf("mac")!=-1);for (var v4=0;v4<v1.length-2;v4+=5){v3=MM_findObj(v1[v4]);if (v3){v3.STI5=v3.src;v3.STI6=v1[v4+1];v3.STI2=v1[v4+2];v3.STI3=v1[v4+3];v3.STI8=v1[v4+4];v2.STI4[v2.STI4.length]=v3;if (v3.filters&&!v2.STI7){flvFSTI3(v3,v3.STI2);v3.onfilterchange=flvFSTI4;v3.filters[0].Apply();}v3.src=v3.STI6;if (v3.filters&&!v2.STI7){v3.filters[0].Play();}}}}


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_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];}
}
// Comma separated list of images to rotate
var imgs = new Array('images/DSCN1209.jpg','images/DSCN1210.jpg');
// delay in milliseconds between image swaps 1000 = 1 second
var delay = 5000;
var counter = 0;

function preloadImgs(){
for(var i=0;i<imgs.length;i++){
MM_preloadImages(imgs[i]);
}
}

function randomImages(){
if(counter == (imgs.length)){
counter = 0;
}
MM_swapImage (flvFSTI1('slider', '',7,7,1,1, imgs[counter++]));
setTimeout('randomImages()', delay);

MM_swapImgRestore (flvFSTI2('slider', ''));
}
//-->
</script>
</head>

<body onload="preloadImgs();randomImages();">
<img src="images/DSCN1209.jpg" name="slider" width="500" height="322" id="Image1"/>
</body>
</html>

Old Pedant
07-22-2010, 02:43 AM
Way way way past time to abandon that incredibly ancient (and even then pretty bad) DuckWalker code.

Go find some *GOOD* image handling code, not that stuff from DumbWeaker.

Really. Truly. Please.

mik-nik
07-22-2010, 08:28 PM
Thanks, . . . I think?

Do you have any recommendations?

Old Pedant
07-22-2010, 08:43 PM
Golly, there are so many of them. Literally hundreds.

It really depends on what effect you are after.

You just want an image-swap-with-transition upon a mouseover? A mouseover of what? The image itself or some other tag?

Or what?

mik-nik
07-22-2010, 09:36 PM
No, I want a 'timed' sliding image effect. When the page is loaded 'img1' is displayed, then after the timed interval 'img2, then 'img3' etc.

Like I say, I'm really a Javascript novice, I use some mootools effects when it comes to altering the coding, I lost.

Thanks for you reply, it is appreciated.

Old Pedant
07-22-2010, 10:22 PM
You mean like this?

http://www.ArtsOfSnohomish.org/index_may2010.asp

Oh...but that's not "sliding"...that's just "fading".

I think what you are looking for is a "LightBox". Again, many of them out there. Google for "lightbox" and find one you like.

The good ones will also take care of preloading the images, so you won't even need the DW code for that.

mik-nik
07-24-2010, 12:36 AM
Not the best example you could have picked..check the code.. no site css definitions and looks like a dogs dinner. It works, I grant, but slick coding it ain't!

Any java pro site would bring the code in on a link!

At the moment 'Duck Waddler' seems to rule.

I just want a someone who knows javascript to give me some help!

mik-nik
07-24-2010, 01:37 AM
The mm_swapimage, must have a LOGICAL argument and that is what I want to know, for example, in vb the open form argument is -

DoCmd.OpenForm(Name,View,Filter,Condition,DataMode,WindowMode,Args)

What is mm_swapimage in javasript (Location,Filename,?,?,?,?,?,.....

please help....





Join Date: Jul 2010
Location: Perth, Scotland
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

Dr Jazz
09-10-2010, 12:27 PM
Hi

I had a similar problem trying to get particular sound to play when when I slected a particular rollover image.

I put in a few lines of code to make sure I was passing the arguments correctly. That might help you explore your arguments .
I have attached a files with more of the code but the relevant section looks like this:

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];}

var argc = a.length;
for (var i = 0; i < argc; i++) {
alert(argc);
alert("Argument " + i + " = " + a[i]);}

var thissound=document.getElementById(a[4]);
thissound.Play();

I hope this helps



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum