Skip to main content
February 14, 2009
Question

Having trouble, thumbnails repeating horizontally on a vertical scroll bar

  • February 14, 2009
  • 1 reply
  • 326 views
Hi every one, I am creating a XML Gallery, I have the gallery working, its just my thumbnails are repeating horizontally, on a vertical scroll bar. I believe it must be the way i have coded my for loop, could any one give me some advice?


example on how my thumbnails are displaying at the moment:

thumbnail 1 Thumbnail 1
Thumbnail 2 Thumbnail 2
thumbnail 3 thumbnail 3

ect


I need it to be
thumbnail 1 Thumbnail 2
Thumbnail 3 Thumbnail 4
thumbnail 5 thumbnail 6

ect


here is the following for loop code i have made for creating the thumbnails:

//creating thumbnails
function createThumbs():void{
for(var i:int = 0; i< thumbsCount; i++){
for(var j:int = 0; j < 2; j++){
var myThumb:Thumbnail = new Thumbnail();
content_mc.addChild(myThumb);
myThumb.buttonMode = true;

//myThumb.x = (120*i)+13;
//myThumb.y = -50;
myThumb.x = (130*j)+20;
myThumb.y = (100*i)+20;
myThumb.i = i+1;
myThumb.j = j;
myThumb.num = myThumb.i;

var loader:Loader = new Loader();
var thumb:String = thumbsArray ;
//var thumb:String = thumbsArray;
var req:URLRequest = new URLRequest(thumb);
loader.load(req);
myThumb.addChild(loader);
loader.y = 0;
loader.x = 0;
myThumb.addEventListener(MouseEvent.CLICK,thumbCli ck);
//j++;
}
}
}
This topic has been closed for replies.

1 reply

Ned Murphy
Legend
February 14, 2009
You don't provide enough info to be certain of what you are trying to process, so the following is generalized based on assumptions. Your problem lies in the line where you use i to define the image name via the array--it does not increment within the j loop. Try something along these lines...