# Dynamic Pageing?!

**URL:** <https://forum.kirupa.com/t/dynamic-pageing/87102>\
**Category:** flash\
**Created:** [April 18, 2005, 3:41pm UTC](https://forum.kirupa.com/t/dynamic-pageing/87102 "2005-04-18T15:41:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![papercut](https://avatars.discourse-cdn.com/v4/letter/p/b4bc9f/32.png) [@papercut](https://forum.kirupa.com/u/papercut)\
**Post date:** [April 18, 2005, 3:41pm UTC](https://forum.kirupa.com/t/dynamic-pageing/87102/1 "2005-04-18T15:41:32Z")

</div>

Hi there. Keep up the good work!  
I’m trying to customize an xml photo gallery and need someone to help me with the pageing. When there are more pictures on the stage than it can hold I need Flash to generate page numbers and send the other pictures on a different page. Anyone who can help? Thanks in advance!

Here is the code:

> 

var thumb\_spacing = 76;  
var thumb\_height = 60;

function GeneratePortfolio(portfolio\_xml)  
{  
var portfolioPictures = portfolio\_xml.firstChild.childNodes;

```
var positionX = 0;
var positionY = 0;
for (var i = 0; i &lt; portfolioPictures.length; i++)

```

{  
var currentPicture = portfolioPictures\*;

```
    var currentThumb_mc = menu_mc.createEmptyMovieClip("thumbnail_mc"+i,i);
    if (positionX &gt; 260)
    {
        positionX = 0;
        positionY += thumb_height;
    }
    currentThumb_mc._x = positionX;
    currentThumb_mc._y = positionY;
    positionX += thumb_spacing;
    
    currentThumb_mc.createEmptyMovieClip("thumb_container",0);
    currentThumb_mc.thumb_container.loadMovie(currentPicture.attributes.thumb);
    
    currentThumb_mc.image = currentPicture.attributes.image;
    
    currentThumb_mc.onRelease = function()

```

{  
image\_mc.loadMovie(this.image);  
}  
currentThumb\_mc.onRollOver = function ()  
{  
this.attachMovie(“rollit”, “newroll”, 1);  
this.newroll.\_alpha = 40;  
}  
currentThumb\_mc.onRollOut = function ()  
{  
this.newroll.removeMovieClip();  
}  
}  
}

// xml object for xml content  
var portfolio\_xml = new XML();  
portfolio\_xml.ignoreWhite = true;  
portfolio\_xml.onLoad = function(success)  
{  
if (success) GeneratePortfolio(this);  
else trace(“Error loading XML file”);  
}  
// load  
portfolio\_xml.load(“portfolio2.xml”);
