PDA

View Full Version : Not Versed in Flash terms: Button loading external imgs problem



kinda86
April 11th, 2009, 05:46 PM
Hi... I tried looking around the site for something to solve my problem but wasn't able to find anything...

I've got an image gallery (http://www.artengine.ca/cgervais/ click on the gallery button and any of the top titles) and right now it's set up so that the images are within the .fla file and the thumbnails on a different movieClip calls on each labeled frame in another movieClip which has the corresponding image. I want to recreate the file so that the thumbnails call on the different images from an external folder...

the issues I am facing with this right now are:

1) I onlly know how to set it up for a "back" and "next botton with actionscript (2.0) as followes:


var slideInfo:LoadVars = new LoadVars();
slideInfo.load("BLOCKS/photogal/slideInfo.txt")

_level0.theMCL.loadClip("BLOCKS/photogal/img" + curImgNum + ".jpg", this.img_mc);
_level0.theLV.load("BLOCKS/photogal/img" + curImgNum + ".txt", this.bio_txt);

//--------------Next BTN--------------

nextBTN.onRelease = function(){
if(curImgNum < Number (slideInfo.totalImgs)){
curImgNum ++;
} else {
curImgNum =1;
}
loadFrame();
}



//-------------------BACK btn------------------

backBTN.onRelease = function(){
if(curImgNum ==1){
curImgNum = Number (slideInfo.totalImgs);
}else {
curImgNum --;
}
loadFrame();
}


//---------functionIMGnTXT----------------

function loadFrame(){
_level0.theMCL.loadClip("BLOCKS/photogal/img" + curImgNum + ".jpg", this.img_mc);
bio_txt.scroll=1;
_level0.theLV.load("BLOCKS/photogal/img" + curImgNum + ".txt", this.bio_txt);

}

//-------------SCROLL--------------------

scrollUP.onPress = function (){
bio_txt.scroll -=1;

}

scrollDOWN.onPress = function(){
bio_txt.scroll +=1;
}
I don't know how to make it so that each individual button calls on the specific image to pop up...

2) the images are not the same size so when i was playing around with the code above the location of vetical and horizontal images are not centered on the stage and are not the right size within the movie clip...

countersweet
April 11th, 2009, 07:16 PM
you can create some movie clip that would be still in middle and you could load the images dynamicaly from different location into that one?

for centering you need a movie clip loader so you know what the size of the image is, let me give you an example of how does movieclip loader work



this.createEmptyMovieClip("photo",this.getNextHighestDepth());
photo.createEmptyMovieClip("holder",photo.getNextHighestDepth());

mcl = new MovieClipLoader();

listener = new Object();
listener.onLoadInit = function(target_mc:MovieClip) {
photo.holder._x=Stage.width/2-photo.holder._width/2;
photo.holder._y=Stage.height/2-photo.holder._height/2;
}

mcl.addListener(listener);
mcl.loadClip(your url here,photo.holder);