# Growing a box in Actionscript over time for XML Photo Gallery

**URL:** <https://forum.kirupa.com/t/growing-a-box-in-actionscript-over-time-for-xml-photo-gallery/246627>\
**Category:** flash\
**Created:** [December 12, 2007, 9:51pm UTC](https://forum.kirupa.com/t/growing-a-box-in-actionscript-over-time-for-xml-photo-gallery/246627 "2007-12-12T21:51:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timelord](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Timelord](https://forum.kirupa.com/u/Timelord)\
**Post date:** [December 12, 2007, 9:51pm UTC](https://forum.kirupa.com/t/growing-a-box-in-actionscript-over-time-for-xml-photo-gallery/246627/1 "2007-12-12T21:51:39Z")

</div>

Let me preface this post with saying that I am currently learning OOP and Actionscript so some of my logic might not be the best around, so any help is appreciated. Now on to the question…

I currently built an XML photo gallery using concepts from tutorials on this site and others. I accomplished loading images into a menu bar that scrolls and on clicking the thumbs you load the main image onto the stage. However, I wanted to add an aesthetic feature where there is a white box that frames the main photo and changes width and height over time to the size of the next image selected. Similar to the effect of this photo gallery:

[http://flashden.net/files/10793/index.html](http://flashden.net/files/10793/index.html)

My problem is that I can figure out how to make the box change to the size I want, but I can’t get it to do it over time. I tried to use setInterval method, but can’t get it to work. Can anyone help me figure this out, I have been wracking my brain for a while now.

Here is the code snippet of how I am changing the box size:

//Xbox\_mc is an instance of a 100px X 100px box movieclip sitting on the root timeline.

//Define Variables

var ImageSizeW = 280;  
var ImageSizeH = 365;

if (ImageSizeW \< ImageSizeH) {  
GrowHthenW();  
}else{  
GrowWthenH();  
}

function GrowWthenH () {  
for(i=Xbox\_mc.\_width; i\<= ImageSizeW-1; i++) {  
\_root.Xbox\_mc.\_xscale ++;  
if(Xbox\_mc.\_height \>= ImageSizeH){  
Xbox\_mc.\_height = ImageSizeH;  
}else{  
\_root.Xbox\_mc.\_yscale ++;  
}  
}  
}

function GrowHthenW () {  
for(i=Xbox\_mc.\_height; i\<= ImageSizeH-1; i++) {  
\_root.Xbox\_mc.\_yscale ++;  
if(Xbox\_mc.\_width \>= ImageSizeW){  
Xbox\_mc.\_width = ImageSizeW;  
}else{  
\_root.Xbox\_mc.\_xscale ++;  
}  
}  
}

trace(Xbox\_mc.\_width);  
trace(Xbox\_mc.\_height);
