Gallery AS

Hi all, I got a flash gallery over at FlashDen - thought it might be best to learn AS from existing code. I managed to do a lot of changes to the code, but now I’m somehow stuck.

The gallery shows a line of thumbnails loaded via XML. You can preset how many thumbs are to be displayed. If there are more thumbs in the gallery, the thumb line scrolls on rollOver.

In this part of the code (I think) the thumb list is built:

menu_mc.scroll_mc.thumb_mc.thumb.duplicateMovieClip("thumb"+i, i);
  menu_mc.scroll_mc.thumb_mc["thumb"+i]._x = (menu_mc.scroll_mc.thumb_mc["thumb"+i]._width+thumbSpace)*i;
  loadMovie(Folder+"/"+Thumb*, menu_mc.scroll_mc.thumb_mc["thumb"+i].holder);
  menu_mc.scroll_mc.thumb_mc["thumb"+i].ID = i;
  menu_mc.scroll_mc.mask_mc._width = ((menu_mc.scroll_mc.thumb_mc.thumb._width+thumbSpace)*maxThumbs)-thumbSpace;
  menu_mc.scroll_mc._x = Math.round(-(Stage.width-stageW)/2+Stage.width/2-menu_mc.scroll_mc.mask_mc._width/2);

Now I’m trying to change this - I wanted two lines of thumbs, 24 images each (48 in total), no scrolling. So I’ll have to change the code to somewhat like this:

  • load the first 24 thumbs
  • start a new line under the first one and load thumbs 25 to 48

Is that possible? I’m really stuck, I’ve been trying to do this change for days now…

Thanks for your help!
B

hi boptilyadrop55,

maybe you should post on flash 8… Flash CS3 here

if (i > 24)
then your actions… should post a bit more of your code, maybe the for cycle where the code you posted is…

Hi Pensamente, thanks a bunch for your comment - this problem is really driving me nuts… I hope you can help me. The code block goes like this:

buildGallery = function () {
 _global.ID = 0;
 destWidth = 0;
 destHeight = 0;
 //Remove previously created photos and thumbs
 for (j=0; j<currentTotal; j++) {
  menu_mc.scroll_mc.thumb_mc["thumb"+j].removeMovieClip();
 }
 total = xmlNode.childNodes[_global.galleryNum].childNodes.length;
 galleryTotal = xmlNode.childNodes.length;
 Folder = xmlNode.childNodes[_global.galleryNum].attributes.Folder;
 maxThumbs = default_maxThumbs;
 //Disable scrolling if too few thumbs
 if (maxThumbs>total) {
  maxThumbs = total;
 }
 // Sets destination width and height for each image  
 for (n=0; n<galleryTotal; n++) {
  Name[n] = xmlNode.childNodes[n].attributes.Name;
  select_mc.selectBttn_mc.selectBttn.duplicateMovieClip("selectBttn"+n, n);
  select_mc.selectBttn_mc["selectBttn"+n]._y = -select_mc.selectBttn_mc.selectBttn._height-(select_mc.selectBttn_mc.selectBttn._height)*n;
  select_mc.selectBttn_mc["selectBttn"+n].txt_mc.txt.text = Name[n];
  select_mc.selectBttn_mc["selectBttn"+n].ID = n;
 }
 for (i=0; i<total; i++) {
  Thumb* = xmlNode.childNodes[galleryNum].childNodes*.attributes.Thumb;
  Large* = xmlNode.childNodes[galleryNum].childNodes*.attributes.Large;
  Caption* = xmlNode.childNodes[galleryNum].childNodes*.attributes.Caption;
  Colour* = xmlNode.childNodes[galleryNum].childNodes*.attributes.Colour;
  Copy* = xmlNode.childNodes[galleryNum].childNodes*.childNodes[0].firstChild.nodeValue;
  //Build thumb menu
  menu_mc.scroll_mc.thumb_mc.thumb.duplicateMovieClip("thumb"+i, i);
  menu_mc.scroll_mc.thumb_mc["thumb"+i]._x = (menu_mc.scroll_mc.thumb_mc["thumb"+i]._width+thumbSpace)*i;
  loadMovie(Folder+"/"+Thumb*, menu_mc.scroll_mc.thumb_mc["thumb"+i].holder);
  menu_mc.scroll_mc.thumb_mc["thumb"+i].ID = i;
  menu_mc.scroll_mc.mask_mc._width = ((menu_mc.scroll_mc.thumb_mc.thumb._width+thumbSpace)*maxThumbs)-thumbSpace;
  menu_mc.scroll_mc._x = Math.round(-(Stage.width-stageW)/2+Stage.width/2-menu_mc.scroll_mc.mask_mc._width/2);
  //Reset scroll menu to first image on gallery load
  menu_mc.scroll_mc.thumb_mc._x = 0;
  menu_mc.scroll_mc.destX = 0;
 }
 loadID();
 currentTotal = total;
};

Thanks!

B