flash modulo help
- Started
- Last post
- 4 Responses
- kinetic
hey all.
i had this wicked script i modified awhile ago that dealt with placement of duplicated movieclips in grid..like..i could specify the max number of elements to duplicate and the max number of elements on the x axis.
i did it with modulo i think...i cant remember.
basically..if you had 10 elements..and the grid only allowed 4 accross, it would be 2 rows of 4 accross and the bottom row would have 2 squares in it.
anyone know how to do this or have any idea what im talking about?
:) Thanks!
- unfittoprint0
something like..........................
posX+=this["myMC"+(k-1)]._width
for (k=0; k0) {
posY+= this["myMC"+k]._height;
posX = 0;
}this["myMC"+k]._x= posX
this["myMC"+k]._y= posY
}
- kinetic0
this is what i have for the duplication part:
for (i=0; i<4; i++) {
// thumbnail generation
duplicateMovieClip(_root.mc_thum... "mc_thumbnail" + i, i);thumbs[i] = eval("_root.mc_thumbnail" + i);
//thumbs[0]._x = 0;
thumbs[i]._x = thumbs[i - 1]._x + 120;
}
- versa0
makeThumbMenu = function () {
item_spacing = 25;
i = 1;
col = 1;
row = 1;
colMax = 5;
while (i<=_parent.myVars.totalItems) {
duplicateMovieClip("thumbItem", "thumb_item_" + i,i);
me = this["thumb_item_" + i];
me.item = eval("_parent.myVars.item" + i);
me._x +=(item_spacing*(row-1));
me._y +=(item_spacing*(col -1));
i++;
row++;
if((i%colMax)==0){
col++;
row =1;
}
}
}something like that?
- kinetic0
ill give that a go
the one i had was sooo simple...its like right on the tip of my tounge...and when i see it im gonna be like "ohhhhhh -- that's how i did it"
haha. anyways, thanks guys! always appreciate it