|
HELP!!
I still have not figured out how to make the virus method appear randomly. It still appears with each click. The virus appearing randomly is the most important part!!
my Progress so far:
I've separated the array from the swapOut function. Then I wrote swapOut to call the array. The problem is that for each image that I need flipped I have to make a new function(swapOutA, swapOutB, swapOutC...). This does work, but its bulky. There has to be a better way.
var images = new Array(25);
images[0] = 'case00.jpg';
images[1] = 'case01.jpg';
images[2] = 'case02.jpg';
images[3] = 'case03.jpg';
images[4] = 'case04.jpg';
images[5] = 'case05.jpg';
images[6] = 'case06.jpg';
images[7] = 'case07.jpg';
images[8] = 'case08.jpg';
images[9] = 'case09.jpg';
images[10] = 'case10.jpg';
images[11] = 'case11.jpg';
images[12] = 'case12.jpg';
images[13] = 'case13.jpg';
images[14] = 'case14.jpg';
images[15] = 'case15.jpg';
images[16] = 'case16.jpg';
images[17] = 'case17.jpg';
images[18] = 'case18.jpg';
images[19] = 'case19.jpg';
images[20] = 'case20.jpg';
images[21] = 'case21.jpg';
images[22] = 'case22.jpg';
images[23] = 'case23.jpg';
images[24] = 'case24.jpg';
function swapOutA()
{
var index = Math.floor(Math.random() * images.length);
document.imageflipA.src= images[index];
}
function swapOutB()
{
var index = Math.floor(Math.random() * images.length);
document.imageflipB.src= images[index];
}
Last edited by needMajorHelp; 11-13-2008 at 03:26 AM..
Reason: still need help, but have made progress
|