I have and array that I fill with elements in a function.
I call it later and want to reset it so that it is empty so I can fill it with different elements and a different number of elements. How do I reset it so that there is nothing in it? I would do it before the If statements, but I'm not sure how to reset it. Could someone help?
[code=javascript]
var imageArray;
var image_dir;
var imageNum =0;
function rotate(pictype)
var i = 0;
if (picType =="weather_pic" ) {
image_dir = "img/w/";
type = "id_w";
imageNum =0;
imageArray = new Array();
for (i=1;i<=26;i++) {
imageArray[imageNum++] = new imageItem(image _dir + i + ".jpg");
}
}
if (picType =="optical_pic" ) {
image_dir = "img/o/";
type = "id_o";
imageNum =0;
imageArray = new Array();
for (i=1;i<=56;i++) {
imageArray[imageNum++] = new imageItem(image _dir + i + ".jpg");
}
}
totalImages = imageArray.leng th;
switchImage(typ e);
[/code]
I call it later and want to reset it so that it is empty so I can fill it with different elements and a different number of elements. How do I reset it so that there is nothing in it? I would do it before the If statements, but I'm not sure how to reset it. Could someone help?
[code=javascript]
var imageArray;
var image_dir;
var imageNum =0;
function rotate(pictype)
var i = 0;
if (picType =="weather_pic" ) {
image_dir = "img/w/";
type = "id_w";
imageNum =0;
imageArray = new Array();
for (i=1;i<=26;i++) {
imageArray[imageNum++] = new imageItem(image _dir + i + ".jpg");
}
}
if (picType =="optical_pic" ) {
image_dir = "img/o/";
type = "id_o";
imageNum =0;
imageArray = new Array();
for (i=1;i<=56;i++) {
imageArray[imageNum++] = new imageItem(image _dir + i + ".jpg");
}
}
totalImages = imageArray.leng th;
switchImage(typ e);
[/code]
Comment