# Gallery AS

**URL:** https://forum.kirupa.com/t/gallery-as/265274
**Category:** flash
**Created:** [July 7, 2008, 10:41am UTC](https://forum.kirupa.com/t/gallery-as/265274 "2008-07-07T10:41:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![boptilyadrop55](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@boptilyadrop55](https://forum.kirupa.com/u/boptilyadrop55)
#### Post date: [July 7, 2008, 10:41am UTC](https://forum.kirupa.com/t/gallery-as/265274/1 "2008-07-07T10:41:06Z")

</div>

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:

```auto
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

---

<div class="post-metadata">

### Author: ![pensamente](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pensamente/32/1208_2.png) [@pensamente](https://forum.kirupa.com/u/pensamente)
#### Post date: [July 7, 2008, 11:57am UTC](https://forum.kirupa.com/t/gallery-as/265274/2 "2008-07-07T11:57:53Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![boptilyadrop55](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@boptilyadrop55](https://forum.kirupa.com/u/boptilyadrop55)
#### Post date: [July 7, 2008, 12:21pm UTC](https://forum.kirupa.com/t/gallery-as/265274/3 "2008-07-07T12:21:37Z")

</div>

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:

```auto
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
