# Changing Images with defined Time Intervals

**URL:** <https://forum.kirupa.com/t/changing-images-with-defined-time-intervals/258141>\
**Category:** Uncategorized\
**Created:** [April 21, 2008, 12:44pm UTC](https://forum.kirupa.com/t/changing-images-with-defined-time-intervals/258141 "2008-04-21T12:44:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lovejeet](https://avatars.discourse-cdn.com/v4/letter/l/977dab/32.png) [@lovejeet](https://forum.kirupa.com/u/lovejeet)\
**Post date:** [April 21, 2008, 12:44pm UTC](https://forum.kirupa.com/t/changing-images-with-defined-time-intervals/258141/1 "2008-04-21T12:44:55Z")

</div>

Hi All,  
I am working on a cbt that has a set of 70 jpg’s and defined time intervals. I have worked out the XML which loads into the fla, but i am not able to write a **function that would change the images at defined intervals**. Please can any one help me on this. Its important.  
Thanks in advance.

Here is the XML Structure.

\<content\>  
\<Video image\_url=“Images/Image01.jpg” image\_duration=“5”\>\</Video\>  
\<Video image\_url=“Images/Image02.jpg” image\_duration=“10”\>\</Video\>  
\</content\>

And here is the code that loads the image in an empty movieclip.

var imageArray1 = new Array();  
var imageArray2 = new Array();  
//Load XML  
var content:XML = new XML();  
content.ignoreWhite = true;  
content.onLoad = function(ok) {  
total1 = content.firstChild.childNodes.length;  
for (var i = 0; i\<total1; ++i) {  
imageArray1\* = new Object();  
imageArray2\* = new Object();  
imageArray1\* = content.firstChild.childNodes\*.attributes.image\_url;  
//trace(imageArray1\*);  
imageArray2\* = content.firstChild.childNodes\*.attributes.image\_duration;  
//trace(imageArray2\*);  
loadImage();  
}  
firstImage();  
//trace(“loaded”);  
};  
content.load(“images.xml”);  
function loadImage() {  
for (var i = 0; i\<total1; ++i) {  
\_root.holder\_mc.loadMovie(imageArray1\*);  
}  
}  
function changeImage() {  
setInterval(loadImage,imageArray2\*);  
trace(imageArray2\*);  
}  
//Loading the First Image  
function firstImage() {  
\_root.holder\_mc.loadMovie(imageArray1[0]);  
}
