I have 8 mc’s (thumb_01, thumb_02 …thumb_08). Those mc’s are insite another mc (thumbsMC) I control them the following way:
function setButton() {
for (var i in thumbsMc) {
if (thumbsMc*._name.substr(0, 6) == "thumb_") {
clip = thumbsMc*;
clip.onRollOver = function() {
this.gotoAndStop(2);
};
clip.onRollOut = function() {
if (!this.pushed) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
};
clip.onRelease = function() {
_root.resetKnop();
this.pushed = true;
this.gotoAndStop(2);
};
}
}
}
function resetKnop() {
for (var i in thumbsMC) {
if (thumbsMC*._name.substr(0, 6) == "thumb_") {
clip = thumbsMc*;
clip.pushed = false;
clip.gotoAndStop(1);
}
}
}
setButton();
In the library I have 8 picture mc’s (album01, album02 … album08) all with a linkage. What kind of function do I need to accomplish that when thumb_01 is pressed, album01 is attached to the container on the stage and the same with the other thumbs.
Try this on the main timeline
for (var i = 1; i<9; i++) {
thumbsMC[“thumb_0”+i].ivar = i;
thumbsMC[“thumb_0”+i].onPress = function() {
_root.container.attachMovie(“album_0”+this.ivar, “album_0”+this.ivar, this.ivar);
};
}
I`ve done it so each is attached at a different depth but if you want to replace one with another just use the same depth.
I did what you;ve said but I cant get it to work. I have attached the zip file. Maybe If you have the time you can have a look at it. To make the file not to heavy I removed the big pictures.
I am unable to find anything with linkage identifier album01 etc.
when i wrote the code before i thought you were attaching album_01etc
so if you give linkage identifiers album01,album02…
use
_root.fotos.containerMC.attachMovie(“album0”+this.ivar, “album0”+this.ivar, 5);
try putting a trace in the clip.onRelease and you`ll see what is happening better
trace(this.ivar)
Both sets of code should work with this.
That was instead of the loop
for (var i = 1; i<9; i++) {
thumbsMC[“thumb_0”+i].ivar = i;
}
so you only need one or the other
I just thought it was more in line with how you are scripting.