# Photo Gallery Help!

**URL:** https://forum.kirupa.com/t/photo-gallery-help/148790
**Category:** Uncategorized
**Created:** [May 23, 2005, 4:41pm UTC](https://forum.kirupa.com/t/photo-gallery-help/148790 "2005-05-23T16:41:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![tecluchi](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@tecluchi](https://forum.kirupa.com/u/tecluchi)
#### Post date: [May 23, 2005, 4:41pm UTC](https://forum.kirupa.com/t/photo-gallery-help/148790/1 "2005-05-23T16:41:19Z")

</div>

Hi , i’m trying to find out a way to add more rows of thumbnails in this photo gallery. Right now it has just one row of thumbnails, but i would like to display about 4 rows with 4 thumbnails in each one of the rows. I think it is possible modifying some AS, the problem is that i can’t make it. Any help will be really appreciated.

Here is the AS:

portfolioInfo = new XML();

portfolioInfo.ignoreWhite = true;

timeline = this;  
var set\_interval = 1;// This value must not be changed!  
var thumbs\_per\_set=3;// Here you can set the number of images per page. Dont use 1, any other number ok!  
var from\_image=0;  
var to\_image=thumbs\_per\_set;  
previous.enabled=false;  
previous.\_visible=false;  
next.enabled=false;  
next.\_visible=false;  
//trace(this);  
this.createEmptyMovieClip("mask", 2);  
//trace(image\_mc.\_x);  
mask.\_x = image\_mc.\_x;  
mask.\_y = image\_mc.\_y;  
mask.beginFill (0xFF0000, 100);  
mask.lineStyle(0, 0, 0);  
mask.lineTo(image\_mc.\_width, 0);  
mask.lineTo(image\_mc.\_width, image\_mc.\_height);  
mask.lineTo(0, image\_mc.\_height);  
mask.lineTo(0, 0);  
endFill();  
image\_mc.setMask(mask);  
MovieClip.prototype.useHandCursor = true;  
[//loaderHolder.loadBar.setMask](https://loaderHolder.loadBar.setMask)(mask3);

// Function when xml is done loading:  
portfolioInfo.onLoad = function() {

```
menu_mc.attachMovie(&quot;loading_set_clip&quot;,&quot;loading_set_clip&quot;, 1);
menu_mc.loading_set_clip._y = 10;
portfolioTag = this.firstChild;
count=portfolioTag.childNodes.length;
remaindar_testing = count % thumbs_per_set;
if (remaindar_testing == 0){total_sets = count / thumbs_per_set;}
else {total_sets = Math.floor(count / thumbs_per_set)+1};
timeline.createEmptyMovieClip(&quot;contain&quot;,1);
for (child=0;child&lt;count;child++){    
    currentPicture = portfolioTag.childNodes[child];
    Thumb = contain.createEmptyMovieClip(&quot;thumb&quot;+child, child);
    pic = Thumb.createEmptyMovieClip(&quot;thumb_image&quot;+child, 0);
    pic.loadMovie(currentPicture.attributes.THUMB);
    Thumb._visible=false;
    if (child == count - 1){initial_set_preload(pic);}
}

```

};

movieClip.prototype.initial\_set\_preload = function (mc) {  
this.onEnterFrame = function() {  
var l = mc.getBytesLoaded();  
var t = mc.getBytesTotal();

```
            if (l&gt;0 && l&gt;=t) {
                
                contain.removeMovieClip();
                loading_set_clip.easeTo(0, 20, 15, &quot;leaving&quot;,0);
                menu_mc.loading_set(from_image,to_image);
                Set = set_interval+&quot; / &quot;+total_sets;
                if (count&lt;=thumbs_per_set){
                    next._visible=false;
                }else{
                    next._visible=true;
                    next.enabled=true;
                }
                delete this.onEnterFrame;
            }
        };

```

};

next.onPress = next.onDragOver=function () {

```
previous.enabled=true;
previous._visible=true;
set_interval++;
Set = set_interval+&quot; / &quot;+total_sets;
menu_mc.removing_set(from_image,to_image);
    
if (to_image &lt; count){
    var temp = count - to_image;
    if (temp &lt; thumbs_per_set) {
        from_image = to_image;
        to_image += temp;
        menu_mc.loading_set(from_image,to_image);
    }
    else {
        from_image = to_image;
        to_image += thumbs_per_set;
        menu_mc.loading_set(from_image,to_image);
    }
    
}
if (to_image == count){
    next.enabled=false;
    next._visible=false;
}

```

};  
previous.onPress = previous.onDragOver=function () {  
next.enabled=true;  
next.\_visible=true;  
set\_interval–;  
Set = set\_interval+" / "+total\_sets;  
menu\_mc.removing\_set(from\_image,to\_image);

```
if (from_image &gt; 0){
    to_image = from_image;
    from_image -= thumbs_per_set;
    menu_mc.loading_set(from_image,to_image);
}
if (from_image == 0) {
    previous.enabled=false;
    previous._visible=false;
}

```

};

MovieClip.prototype.loading\_set= function(from,to) {  
var counter = 0; //distance…location  
for (child=from; child\<to; child++) {

```
    currentPicture = portfolioTag.childNodes[child];
    currentThumb = menu_mc.createEmptyMovieClip(&quot;thumbnail&quot;+child, child);
    currentThumb._x = (counter*80);
    currentThumb._y = (child*0)+40;
    
    image = currentThumb.createEmptyMovieClip(&quot;thumbnail_image&quot;, 0);
    image.loadMovie(currentPicture.attributes.THUMB);
    
    currentThumb.NAME = currentPicture.attributes.NAME;
    currentThumb.IMAGE = currentPicture.attributes.IMAGE;
    currentThumb.TEXT = currentPicture.attributes.TEXT;
    
    currentThumb.onRollOver = currentThumb.onDragOver=function () {
        showName_txt.text = this.Name;
        this.attachMovie(&quot;blink&quot;,&quot;blink&quot;,1001);
        this.blink._height=42;
        this.blink._width=70;
    };
    
    currentThumb.onRollOut = currentThumb.onDragOut=function () {
        showName_txt.text = &quot;&quot;;
        this.blink.removeMovieClip();
        this.blinkRelease.removeMovieClip();
    };
    
    currentThumb.onPress = currentThumb.onDragOver=function () {
        
        if (current_thumb != this) {
            current_thumb = this;
            to_x=image_mc._x;
            to_y=350;
            image_mc.easeTo_image(to_x,to_y,7,0, this.image, &quot;down&quot;);
            this.attachMovie(&quot;blinkRelease&quot;,&quot;blinkRelease&quot;,1000);
            this.blinkRelease._height=42;
            this.blinkRelease._width=70;
            info_txt.text = &quot;Text Loading...&quot;;
            timeline.loadVariables(this.TEXT);
        }
    };
    
    menu_mc[&quot;thumbnail&quot;+child].easeTo(80*counter, 15, 7, &quot;coming&quot;,100);
    counter++;
}

```

};

MovieClip.prototype.removing\_set= function(from,to) {  
var counter=0;

```
for (child=from; child&lt;to; child++) {
    menu_mc[&quot;thumbnail&quot;+child].easeTo(80*counter, 40, 15, &quot;leaving&quot;,0);
    counter++;

}

```

};

loadPic = function (pic) {

```
image_mc.loadMovie(pic);
mask._visible=false;
preload(image_mc,1);

```

};

MovieClip.prototype.preload = function(mc, location) {

```
var loader_x=480;
var loader_y=140;

status=false;
this.onEnterFrame = function() {
    var l = mc.getBytesLoaded();
       var t = mc.getBytesTotal();
       var getPercent = l/t;

    var percent = getPercent*100;        
    LoaderHolder.loadBar._width += (percent - LoaderHolder.loadBar._width) / 20;

    if (l&gt;0 && l&gt;=t) {

        LoaderHolder.loadBar._width = 100;
        LoaderHolder.easeTo(loader_x, 170, 15, &quot;leaving&quot;,0);
        image_mc.setMask(mask);
        mask._visible=true;
        mc.easeTo_image(to_x,0,7,100,image,&quot;up&quot;);
        mc._visible = 1;
        delete this.onEnterFrame;
    }
    
    else {
        if (status==false) {
            status=true;
            this.attachMovie(&quot;LoaderHolder&quot;, &quot;LoaderHolder&quot;, 1);
            LoaderHolder._alpha=0;
            LoaderHolder._x=loader_x;
            LoaderHolder._y=loader_y+20;
            LoaderHolder.loadBar._width = 0;
            LoaderHolder.easeTo_image(loader_x,loader_y,6,100,image,&quot;up&quot;);
            
        }
    }
        
};

```

};

MovieClip.prototype.easeTo\_image = function(x, y, speed, fading\_to, image, dir) {  
//image\_mc.setMask(mask2);  
if (dir == "down"){  
this.onEnterFrame = function() {  
//set move to location  
[//this.enabled=false](https://this.enabled=false);  
this.eX = Math.round(x-this.\_x);  
this.eY = Math.round(y-this.\_y);  
//ease to location  
this.\_alpha = this.\_alpha+(fading\_to-this.\_alpha)/6;  
this.\_x += this.eX/speed;  
this.\_y += this.eY/speed;  
//if the eX and eY variables are both equal to 0  
if (!this.eX && !this.eY) {  
//place the clip at the final destination point  
this.\_x = x;  
this.\_y = y;

```
            loadPic(image);
            
            
            //stop running the onEnterFrame
            delete this.onEnterFrame;
            //this.removeMovieClip();
        }
    };
}else if (dir == &quot;up&quot;) {
    this.onEnterFrame = function() {
        //set move to location
        //this.enabled=false;
        this.eX = Math.round(x-this._x);
        this.eY = Math.round(y-this._y);
        //ease to location
        this._alpha = this._alpha+(fading_to-this._alpha)/6;
        this._x += this.eX/speed;
        this._y += this.eY/speed;
        //if the eX and eY variables are both equal to 0
        if (!this.eX && !this.eY) {
            //place the clip at the final destination point
            this._x = x;
            this._y = y;
            //stop running the onEnterFrame
            delete this.onEnterFrame;
            //this.removeMovieClip();
        }
    };
}

```

};  
MovieClip.prototype.easeTo = function(x, y, speed, where\_to, fading\_to) {  
if (where\_to=="leaving"){  
this.onEnterFrame = function() {  
//set move to location  
this.enabled=false;  
this.eX = Math.round(x-this.\_x);  
this.eY = Math.round(y-this.\_y);  
//ease to location  
this.\_alpha = this.\_alpha+(fading\_to-this.\_alpha)/6;  
this.\_x += this.eX/speed;  
this.\_y += this.eY/speed;  
//if the eX and eY variables are both equal to 0  
if (!this.eX && !this.eY) {  
//place the clip at the final destination point  
this.\_x = x;  
this.\_y = y;  
//stop running the onEnterFrame  
delete this.onEnterFrame;  
this.removeMovieClip();  
}  
};  
}  
else {  
this.\_alpha=0;  
this.enabled=false;  
this.onEnterFrame = function() {  
//set move to location  
this.eX = Math.round(x-this.\_x);  
this.eY = Math.round(y-this.\_y);  
//ease to location  
this.\_alpha = this.\_alpha+(fading\_to-this.\_alpha)/6;  
this.\_x += this.eX/speed;  
this.\_y += this.eY/speed;  
//if the eX and eY variables are both equal to 0  
if (!this.eX && !this.eY) {  
//place the clip at the final destination point  
this.\_x = x;  
this.\_y = y;  
//stop running the onEnterFrame  
this.enabled=true;  
delete this.onEnterFrame;  
}  
};  
}  
};

portfolioInfo.load("xmlstuff/portfolio\_config.xml");  
//stop();
