# Multiple mc's...XML random imageloader + fade

**URL:** https://forum.kirupa.com/t/multiple-mcs-xml-random-imageloader-fade/258725
**Category:** flash
**Created:** [April 27, 2008, 1:48pm UTC](https://forum.kirupa.com/t/multiple-mcs-xml-random-imageloader-fade/258725 "2008-04-27T13:48:49Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![p1x3lman](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@p1x3lman](https://forum.kirupa.com/u/p1x3lman)
#### Post date: [April 27, 2008, 1:48pm UTC](https://forum.kirupa.com/t/multiple-mcs-xml-random-imageloader-fade/258725/1 "2008-04-27T13:48:49Z")

</div>

Hi there,  
Have been a big fan for a while - first post today!  
I have compiled a header.swf for a site that loads external images utilising XML and presents fades between selected random images. I have this working for one mc on stage.  
I’d like some help to get 3 x other clips (same size, spaced equidistant in a single row) loading images from the same directory, with each clip to display a different image.

A couple of q’s…

1. is an array of mc’s the best way to achieve this? then
2. append the ‘[COLOR=RoyalBlue]imageFileName[ran]’ [COLOR=Black]to the array?

Any assistance greatly appreciated!  
[/COLOR][/COLOR]

```auto

[COLOR=RoyalBlue]import mx.transitions.Tween;
import mx.transitions.easing.*;

pauseTime = 2000;

xmlImages = new XML();
xmlImages.ignoreWhite = true;
xmlImages.onLoad = loadImages;
xmlImages.load("images.xml");

function loadImages(loaded) {
    if (loaded) {
        xmlFirstChild = this.firstChild;
        imageFileName = [];
        totalImages = xmlFirstChild.childNodes[0].childNodes.length;
        for (i=0; i<totalImages; i++) {
            imageFileName* = xmlFirstChild.childNodes[0].childNodes*.attributes.title;
        }
        randomImage();
    }
}
function randomImage() {
    if (loaded == filesize) {
        var ran = Math.round(Math.random() * (totalImages - 1));
        image_mc._alpha = 0;  
        image_mc.loadMovie(imageFileName[ran], 1);  
        var pictureTweenIn:Tween = new Tween (image_mc,"_alpha",normal.easeIn,0,100,0.5,true); 
        pictureTweenIn.onMotionFinished = function () { 
            _root.pause();  
        }
    }
}
function pause() {
    myInterval = setInterval(pause_slideshow, pauseTime);
    function pause_slideshow() {
        clearInterval(myInterval);

        var pictureTweenOut:Tween = new Tween (image_mc,"_alpha",normal.easeOut,100,0,0.5,true); 
        pictureTweenOut.onMotionFinished = function () { 
            _root.randomImage();  
        }
    }
}[/COLOR]

```
