I’m having a hard time taking the .jpg’s that I have loaded into movie clips and turning them into buttons. Does anyone know why my second for loop isn’t creating code for the movies? Help will be greatly appreciated.
The code I’m using:
//load the photo’s into arrays
thumblist=‘thumb0.jpg, thumb1.jpg, thumb2.jpg, thumb3.jpg’;
imagelist=‘pic0.jpg, pic1.jpg, pic2.jpg, pic3.jpg’;
//split the arrays up into lists that are passes to another total array.
var thumbarray:Array = thumblist.split(", “);
var imagearray:Array = imagelist.split(”, ");
//start looping and creating movie clips containing the array’d photos
for(var i=0;i<thumbarray.length;i++){
//load the photos from the array into the photo boxes
_root[‘thumb’+i].loadMovie(‘thumbs/’+thumbarray*, thumb*);
_root[‘thumb’+i]._width = 25;
_root[‘thumb’+i]._height = _root[‘thumb’+i]._width;
}
//create a button function for each one loaded
for (var j=0;j<thumbarray.length;j++){
//_root[‘thumb’+j].useHandCursor = true;
_root[‘thumb’+j].onRelease = function () {
startloading(‘images/pic’+j+’.jpg’, imageLoader);
infofield._visible = true;
}
}
//preloader
function startLoading(currentimage){
loadMovie(currentimage, imageLoader);
_root.onEnterFrame = function(){
infoloaded = imageLoader.getBytesLoaded();
infototal = imageLoader.getBytesTotal();
percentage = Math.floor(infoloaded/infototal*100);
infofield.text = percentage+"%";
if(percentage>=100){
delete this.onEnterFrame;
infofield._visible = false;
}
}
}