Hi,
I’ve been working on this problem for a while now and posted it to the Flash 8 forum but it should probably be in the actionscript one instead. I am trying to make a Flash program that makes a series of still photos look something like a video by fading the photos into each other as a slider bar is moved across the screen. The photos are of an outdoor scene at different times of day, for example, 8AM, 9AM, 10AM. I want to have these photos fade into each other for each hourly interval so that the user can observe a simulated day passing. The photos themselves are taken from an XML file, which I figured out from the Kirupa tutorial. The slider bar component uses the Kirupa slider bar code.
For each region, for example, 8AM to 9AM, my strategy is to have both the 8AM image and the 9AM images loaded. The 9AM image, however, stays underneath while the alpha of the 8AM image is gradually reduced over the region. Here is the code I have so far. Currently the images are not showing consistantly. The image shown corresponding to a certain slider bar location seems to vary depending on the number of times the slider bar has slid back and forth over that location. I think I do not have the images loading in the correct place, or something. If you have a better way to do this kind of thing I would love to hear about it. Thank you!! :look:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
imageloaded=[];
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
imageloaded* = false;
}
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“images_rosie.xml”);
this.onEnterFrame=function(){
/////for first region (8AM to 9AM)
//this part should check to see if it's in that region
//and load the right images if they are not yet loaded
if ((0<=myslider.ratio) && (myslider.ratio<15)&&(imageloaded[0]==false)){
for (var i = 0; i<image.length; i++) {
imageloaded* = false;
}
imageloaded[0] = true;
imageloaded[1]=true;
picturespot0.swapDepths(200);
//picturespot1.swapDepths(0);
//picturespot0.loadMovie(image[0]);
//picturespot1.loadMovie(image[1]);
//this part should check to see if it's in the first of three subregions
//and give the images it the right alpha value
if ((0<=myslider.ratio) && (myslider.ratio<5)){
//trace(myslider.ratio);
picturespot0._alpha=100;
picturespot1._alpha=100;
//picturespot0.swapDepths(200);
//picturespot1.swapDepths(5);
//picturespot0.swapDepths(picturespot1);
picturespot0.loadMovie(image[0]);
picturespot1.loadMovie(image[1]);
} else if ((5<=myslider.ratio) && (myslider.ratio<10)){
picturespot0._alpha=50;
picturespot1._alpha=100;
//picturespot0.swapDepths(300);
//picturespot1.swapDepths(3);
//picturespot0.swapDepths(picturespot1);
picturespot0.loadMovie(image[0]);
picturespot1.loadMovie(image[1]);
} else if ((10<=myslider.ratio) && (myslider.ratio<15)){
picturespot0._alpha=0;
picturespot1._alpha=100;
//picturespot0.swapDepths(400);
//picturespot1.swapDepths(4);
//picturespot0.swapDepths(picturespot1);
picturespot0.loadMovie(image[0]);
picturespot1.loadMovie(image[1]);
}
}else if ((15<=myslider.ratio) ){
trace(“in next region; repeat above code for total number of regions”);
for (var i = 0; i<image.length; i++) {
imageloaded* = false;
}
imageloaded[2]=true;
imageloaded[1]=true;
picturespot0.swapDepths(300);
picturespot1.swapDepths(3);
picturespot0.loadmovie(image[1]);
picturespot1.loadmovie(image[2]);
}
}