-
Rainy Day Member
Help with attachMovie()
Hey guys,
Ok I have this code
Code:
thumbCount = 10;
row = 1;
for (var k = 1; k <= this.thumbCount; k++, row++) {
this.attachMovie("thumb","thumb" + k, k);
clip = this["thumb" + k].thumb.temp.thumbholder;
clip.loadMovie("images/"+ k + ".jpg");
this["thumb" + k]._x = row * 71;
this["thumb" + k]._y = 175;
}
//
Now the question is how do I get the following script to attach to each instance of the generated movieclips.
Code:
//
on(rollOver){
this.thumb.gotoAndPlay("in");
}
on(release, releaseOutside){
loadMovie("images/" + k + ".jpg",_root.empty);
}
//
As you can see Im trying to generate 10 thumbnails that when clicked open the corresponding picture.
Is there a better way?
Thanks In advance
Last edited by eightamrock; 03-01-2005 at 08:43 PM.
"Shhhhh I have insomnia and Im trying to sleep it off."
-
Code:
this["thumb" + k].onRelease = function()
{
// Needed code here
}
And the same way with onRollOver & onRollOut... using this keyword inside of these functions you can refer to the button you're working with. So it is possible to track image downloading progress and so on.
Never give up...
-
Flashkit Veteran
code:
//add this code so it runs the entire time
for(i = 1;i <= this.thumbCount;i++) {
this["thumb" + i].onRollOver = function() {
this["thumb"+ i].thumb.gotoAndPlay("in");
}
this["thumb" + i].onRelease = this["thumb" + i].onReleaseOutside = function() {
loadMovie("images/" + i + ".jpg",_root.empty);
}
}
hope it works
-
Rainy Day Member
I tried both of these methods, however all the links are looking for "11.jpg" so somewhere in the code its not posting the initial variable number from when it was created.
hmmm.....
"Shhhhh I have insomnia and Im trying to sleep it off."
-
Rainy Day Member
I figured it out for those of you who helped and are curious
this is on the first frame of the movie
Code:
thumbCount = 10;
row = 1;
for (var k = 1; k <= this.thumbCount; k++, row++) {
this.attachMovie("thumb","thumb" + k, k);
clip = this["thumb" + k].thumb.temp.thumbholder;
clip.loadMovie("images/"+ k + ".jpg");
this["thumb" + k]._x = row * 71;
this["thumb" + k]._y = 175;
this["thumb" + k].thumb.image = k;
}
this is inside the duplicated MC in the first frame
this is on the button in the MC
Code:
on(rollOver){
this.gotoAndPlay("in");
}
on(release){
loadMovie("images/"+image+".jpg",_root.empty);
}
Thanks for all your help
"Shhhhh I have insomnia and Im trying to sleep it off."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|