Question
Advanced photo gallery - need help with MCs
Hello all. I have a photo gallery I am creating that can
contain up to 120 images. Rather than create buttons and movie
clips for each, I am hoping to dynamically build it with 1 movie
clip. But I am having trouble with my code. Here's what I am trying
to do:
Duplicate a movie clip on the stage with an instance name of e1, giving each successive MC an instance name of e[i+1]
load external images into each movie clip representing images e1 through e120
set the alpha of the movie clip to 50%
then onRollOver:
Set alpha to 100%, resetting to 50% onRollOut
onPress
assign a variable equal to the image loaded (e1 - e120)
pop up a box and pass the variable into it, which will then load a larger version of the same image being called from a different folder.
That being said, here's my flawed code
var i:Number;
for (i = 0; i < 119; i++) {
this.holder.duplicateMovieClip; //duplicates the MC holder already on the stage
this._name = "e"+i;
this["e"+i]_x = _x + 50;
this["e"+i]._alpha = 50;
this.loadMovie("images/thumbnails/e" + i + ".jpg");
}
This code is not working on anything other than the first MC.
Here is the code for mouseover functions:
var i:Number;
for (i = 0; i < 119; i++) {
this["e"+i].onRollOver=function() {this["e"+i]._alpha=100};
this["e"+i].onRollOut=function() {this["e"+i]._alpha=50};
this["e"+i].onPress=function() {
_root.myVar = ["e"+i];
_root.myLargeImage.gotoAndPlay(2)
}
}
The problem with this section of code is that the dynamically loaded movie clips do not accept any event commands (onRollOver, onPress, etc). It is fine before I load external jpegs, but not noce they are loaded
Any help would be GREATLY appreciated.
Thanks
Duplicate a movie clip on the stage with an instance name of e1, giving each successive MC an instance name of e[i+1]
load external images into each movie clip representing images e1 through e120
set the alpha of the movie clip to 50%
then onRollOver:
Set alpha to 100%, resetting to 50% onRollOut
onPress
assign a variable equal to the image loaded (e1 - e120)
pop up a box and pass the variable into it, which will then load a larger version of the same image being called from a different folder.
That being said, here's my flawed code
var i:Number;
for (i = 0; i < 119; i++) {
this.holder.duplicateMovieClip; //duplicates the MC holder already on the stage
this._name = "e"+i;
this["e"+i]_x = _x + 50;
this["e"+i]._alpha = 50;
this.loadMovie("images/thumbnails/e" + i + ".jpg");
}
This code is not working on anything other than the first MC.
Here is the code for mouseover functions:
var i:Number;
for (i = 0; i < 119; i++) {
this["e"+i].onRollOver=function() {this["e"+i]._alpha=100};
this["e"+i].onRollOut=function() {this["e"+i]._alpha=50};
this["e"+i].onPress=function() {
_root.myVar = ["e"+i];
_root.myLargeImage.gotoAndPlay(2)
}
}
The problem with this section of code is that the dynamically loaded movie clips do not accept any event commands (onRollOver, onPress, etc). It is fine before I load external jpegs, but not noce they are loaded
Any help would be GREATLY appreciated.
Thanks