Hey kirupians, really struggling with this - have got so far - think have cracked it and SLAM brick wall… groan…
I have an array holding ‘image’ and ‘name’
name loops fine and populates a load of movie clips underneath each other…
i need for when this name is clicked to load an image in another movie clip (image name comes from the array)…
the code i have works but it only pulls throught the last item of the array which points to a problem with ‘i’ not being carried across the functions…?
that is the result of my investigation smokes pipe - any help would be appreciated!.
function loadceleb() {
for (i=0; i<total; i++) {
this.contentMain.attachMovie("chold", "hold"+i, i, {_x:xPos, _y:yPos});
yPos += this.contentMain["hold"+i]._height+5;
this.contentMain["hold"+i].text_hold = clname*;
// at this point textboxes are populated and set up on the stage
imagename = image*;
// tried tying imagename to the image array so i can then use in the function below
this.contentMain["hold"+i].onPress = function() {
_root.image_cont.gotoAndPlay(109);
this.celeb.img.loadMovie(imagename);
// this works fine but only pulls through the last image in the array - argh!
trace(imagename);
_root.image_cont.celeb.lineani.gotoAndPlay(1);
};
}
}
stop();
only the image side of things, the buttons and text work perfectly - which makes me think its an error on my part on how im trying to get at the image array…
if i trace the whole array trace (image); it works fine…
it was _global.i i needed to declare above my functions then use this throughout as opposed to just ‘i’ that way it holds the value of ‘i’ throughout the functions and picks the right image from the array when clicking on the button…