greasonwolfe
09-24-2005, 01:48 AM
Okay, so I figured out one problem I was having with this code and fixed that, but now I am hitting a snag with two other problems.
The basic idea is that there are three images I want to fade in and out in a sequential order. For the time being, I am working solely with alpha opacity (will be adding code for FF in the future) and was pretty sure I had it worked out that one image would fade out while the next image faded in. Unfortunately it is not doing what it is supposed to and instead of fading from the first image to the next, it is snapshotting from the first to the second. Furthermore, it doesn't seem to be going to the third image at all. I am not getting any error messages from the script, but I am at a complete loss as to why it isn't preforming the fade function or continuing through the sequential order. Any hints on which direction I should go (or for that matter, anyone willing to point out a blatant error on my part) would be welcomed. I've highlighted the part of the code that doesnt seem to be working as it should.
<script type="text/javascript" charset="ISO-8859-1">
<!--
var allimgs=new Array("desertbg2.jpg","illyanaone.jpg","illyanatwo.jpg","illyanatre.jpg","temple.gif","momglyph.gif","momnonglyph.gif","roeglyph.gif","roenonglyph.gif","totmglyph.gif","totmnonglyph.gif")
var imgload=new Array()
var whichimg=new Array("illypic1","illypic2","illypic3")
var currentimg=0
var nextimg=1
var fade = new Array(100,0,0)
for (pl=0;pl<allimgs.length;pl++)
{
imgload[pl]=new Image()
imgload[pl].src=allimgs[pl]
}
function initializeview()
{
document.getElementById("illypic1").filters.alpha.opacity=fade[0]
document.getElementById("illypic2").filters.alpha.opacity=fade[1]
document.getElementById("illypic3").filters.alpha.opacity=fade[2]
setTimeout("startrotation()",3000)
}
function startrotation()
{
for (fr=0;fr<20;fr++)
{
fade[currentimg]=fade[currentimg]-10
fade[nextimg]=fade[nextimg]+10
document.getElementById(whichimg[currentimg]).filters.alpha.opacity=fade[currentimg]
document.getElementById(whichimg[nextimg]).filters.alpha.opacity=fade[nextimg]
}
if (nextimg=2)
{
nextimg=0
}
else
{
nextimg=nextimg+1
}
if (currentimg=2)
{
currentimg=0
}
else
{
currentimg=currentimg+1
}
setTimeout("startrotation()",3000)
}
-->
</script>
The basic idea is that there are three images I want to fade in and out in a sequential order. For the time being, I am working solely with alpha opacity (will be adding code for FF in the future) and was pretty sure I had it worked out that one image would fade out while the next image faded in. Unfortunately it is not doing what it is supposed to and instead of fading from the first image to the next, it is snapshotting from the first to the second. Furthermore, it doesn't seem to be going to the third image at all. I am not getting any error messages from the script, but I am at a complete loss as to why it isn't preforming the fade function or continuing through the sequential order. Any hints on which direction I should go (or for that matter, anyone willing to point out a blatant error on my part) would be welcomed. I've highlighted the part of the code that doesnt seem to be working as it should.
<script type="text/javascript" charset="ISO-8859-1">
<!--
var allimgs=new Array("desertbg2.jpg","illyanaone.jpg","illyanatwo.jpg","illyanatre.jpg","temple.gif","momglyph.gif","momnonglyph.gif","roeglyph.gif","roenonglyph.gif","totmglyph.gif","totmnonglyph.gif")
var imgload=new Array()
var whichimg=new Array("illypic1","illypic2","illypic3")
var currentimg=0
var nextimg=1
var fade = new Array(100,0,0)
for (pl=0;pl<allimgs.length;pl++)
{
imgload[pl]=new Image()
imgload[pl].src=allimgs[pl]
}
function initializeview()
{
document.getElementById("illypic1").filters.alpha.opacity=fade[0]
document.getElementById("illypic2").filters.alpha.opacity=fade[1]
document.getElementById("illypic3").filters.alpha.opacity=fade[2]
setTimeout("startrotation()",3000)
}
function startrotation()
{
for (fr=0;fr<20;fr++)
{
fade[currentimg]=fade[currentimg]-10
fade[nextimg]=fade[nextimg]+10
document.getElementById(whichimg[currentimg]).filters.alpha.opacity=fade[currentimg]
document.getElementById(whichimg[nextimg]).filters.alpha.opacity=fade[nextimg]
}
if (nextimg=2)
{
nextimg=0
}
else
{
nextimg=nextimg+1
}
if (currentimg=2)
{
currentimg=0
}
else
{
currentimg=currentimg+1
}
setTimeout("startrotation()",3000)
}
-->
</script>