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…
- is an array of mc’s the best way to achieve this? then
- append the ‘[COLOR=RoyalBlue]imageFileName[ran]’ [COLOR=Black]to the array?
Any assistance greatly appreciated!
[/COLOR][/COLOR]
[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]