# Image sizing in Image Gallery

**URL:** <https://forum.kirupa.com/t/image-sizing-in-image-gallery/262227>\
**Category:** flash\
**Created:** [June 4, 2008, 9:21am UTC](https://forum.kirupa.com/t/image-sizing-in-image-gallery/262227 "2008-06-04T09:21:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cazwalks](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@cazwalks](https://forum.kirupa.com/u/cazwalks)\
**Post date:** [June 4, 2008, 9:21am UTC](https://forum.kirupa.com/t/image-sizing-in-image-gallery/262227/1 "2008-06-04T09:21:03Z")

</div>

I have used the Kirupa xml flash photo gallery at this link (code below) [http://www.kirupa.com/developer/mx2004/xml\_flash\_photogallery9.htm](http://www.kirupa.com/developer/mx2004/xml_flash_photogallery9.htm)

i was wondering how do i change the code so that the pictures can be different sizes… and where would the new code fit in to what i have already got from the tutorial?

function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
image = [];  
description = [];  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
image\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
description\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
}  
firstImage();  
} else {  
content = “file not loaded!”;  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“images.xml”);  
/////////////////////////////////////  
listen = new Object();  
listen.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
prevImage();  
} else if (Key.getCode() == Key.RIGHT) {  
nextImage();  
}  
};  
Key.addListener(listen);  
previous\_btn.onRelease = function() {  
prevImage();  
};  
next\_btn.onRelease = function() {  
nextImage();  
};  
/////////////////////////////////////  
p = 0;  
this.onEnterFrame = function() {  
filesize = picture.getBytesTotal();  
loaded = picture.getBytesLoaded();  
preloader.\_visible = true;  
if (loaded != filesize) {  
preloader.preload\_bar.\_xscale = 100\*loaded/filesize;  
} else {  
preloader.\_visible = false;  
if (picture.\_alpha\<100) {  
picture.\_alpha += 10;  
}  
}  
};  
function nextImage() {  
if (p\<(total-1)) {  
p++;  
if (loaded == filesize) {  
picture.\_alpha = 0;  
picture.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
picture\_num();  
}  
}  
}  
function prevImage() {  
if (p\>0) {  
p–;  
picture.\_alpha = 0;  
picture.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
picture\_num();  
}  
}  
function firstImage() {  
if (loaded == filesize) {  
picture.\_alpha = 0;  
picture.loadMovie(image[0], 1);  
desc\_txt.text = description[0];  
picture\_num();  
}  
}  
function picture\_num() {  
current\_pos = p+1;  
pos\_txt.text = current\_pos+" / "+total;  
}

thanks

cazwalks

---

<div class="post-metadata">

**Author:** ![cazwalks](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@cazwalks](https://forum.kirupa.com/u/cazwalks)\
**Post date:** [June 5, 2008, 8:13am UTC](https://forum.kirupa.com/t/image-sizing-in-image-gallery/262227/2 "2008-06-05T08:13:56Z")

</div>

hi, thanks for your response, i will have a go today and let you know how i get on.

---

<div class="post-metadata">

**Author:** ![cazwalks](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@cazwalks](https://forum.kirupa.com/u/cazwalks)\
**Post date:** [June 5, 2008, 8:18am UTC](https://forum.kirupa.com/t/image-sizing-in-image-gallery/262227/3 "2008-06-05T08:18:28Z")

</div>

hi, this is what i require but what happens is that no pictures show up! preloader still works, names are recognised from the xml file but no pictures!

---

<div class="post-metadata">

**Author:** ![cazwalks](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@cazwalks](https://forum.kirupa.com/u/cazwalks)\
**Post date:** [June 5, 2008, 8:20am UTC](https://forum.kirupa.com/t/image-sizing-in-image-gallery/262227/4 "2008-06-05T08:20:14Z")

</div>

ok got it to work now i had put the code a bit further down the page! now it works! thank you :thumb2:

---

<div class="post-metadata">

**Author:** ![cazwalks](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@cazwalks](https://forum.kirupa.com/u/cazwalks)\
**Post date:** [June 5, 2008, 8:25am UTC](https://forum.kirupa.com/t/image-sizing-in-image-gallery/262227/5 "2008-06-05T08:25:50Z")

</div>

what if you want it to recognize the size of your picture?

---

<div class="post-metadata">

**Author:** ![cazwalks](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@cazwalks](https://forum.kirupa.com/u/cazwalks)\
**Post date:** [June 5, 2008, 11:47am UTC](https://forum.kirupa.com/t/image-sizing-in-image-gallery/262227/6 "2008-06-05T11:47:40Z")

</div>

hi sorry to be a pain! Having tried this new code… the pictures dont come in! any ideas?
