Hello, I'm using the code below for a flash picture rotator that uses an xml file that I create when the user lands on a particular page. Each page may have different images that will rotate in the rotator. My issue is cache on the client. The images do not change even though the xml file has different images then the initial xml file. I'm trying to modify the original author's code for the rotator by changing the load method. I read that this is possible from another site. I have to admit that my flash skills are lacking and I need some help here.
Here is the actionscript. The error in on the load method.
How can I get this to work??
/*************************
***/
/* Crossfading slide show */
/* Author: Todd Dominey */
/*
http://whatdoiknow.org */
/*
http://domineydesign.com */
/*************************
***/
// set random # variables - each must be 0 for first 'while' loop below
var randomNum = 0;
var randomNumLast = 0;
// parent container
var container_mc = this.createEmptyMovieClip(
"container
",0);
// movie clip containers
container_mc.createEmptyMo
vieClip("l
oader1_mc"
,2);
container_mc.createEmptyMo
vieClip("l
oader2_mc"
,1);
// preload watcher
this.createEmptyMovieClip(
"watcher_m
c",100);
// load xml
images_xml = new XML();
images_xml.ignoreWhite=tru
e;
images_xml.onLoad = parse;
//images_xml.load("images.
xml");
images_xml.load("images.xm
l?+Math.r
andom());
//xml.load(xmlFile.xml?+
Math.rando
m());
function parse(success) {
if (success) {
imageArray = new Array();
var root = this.firstChild;
_global.numPause = Number(8 * 1000);
_global.order = 'sequential';
_global.looping = 'yes';
_global.fadetime = 2;
_global.xpos =0;
_global.ypos = 0;
var imageNode = root.lastChild;
var s=0;
while (imageNode.nodeName != null) {
imageData = new Object;
imageData.path = imageNode.attributes.path;
imageArray[s]=imageData;
imageNode = imageNode.previousSibling;
s++;
}
// place parent container
container_mc._x = _global.xpos;
container_mc._y = _global.ypos;
// parse array
imageArray.reverse();
imageGen(imageArray);
} else {
trace('problem');
}
}
// depth swapping
function swapPlace(clip,num) {
eval(clip).swapDepths(eval
("containe
r_mc.loade
r"+num+"_m
c"));
}
function loadImages(data,num) {
if (i==undefined || i == 2) {
i=2;
createLoader(i,data,num);
i=1;
} else if (i==1) {
createLoader(i,data,num);
i=2;
}
}
function createLoader(i,data,num) {
thisLoader=eval("container
_mc.loader
"+i+"_mc")
;
thisLoader._alpha=0;
thisLoader.loadMovie(data[
num].path)
;
watcher_mc.onEnterFrame=fu
nction () {
var picLoaded = thisLoader.getBytesLoaded(
);
var picBytes = thisLoader.getBytesTotal()
;
if (isNaN(picBytes) || picBytes < 4) {
return;
}
if (picLoaded / picBytes >= 1) {
swapPlace("container_mc.lo
ader2_mc",
1);
alphaTween = new mx.transitions.Tween(thisL
oader, "_alpha", mx.transitions.easing.Regu
lar.easeOu
t,0,100,_g
lobal.fade
time,true)
;
timerInterval = setInterval(imageGen,_glob
al.numPaus
e,data);
delete this.onEnterFrame;
}
}
}
function imageGen(data) {
// random, or sequential?
if (_global.order=="random") {
// choose random # between 0 and total number of images
while (randomNum == randomNumLast) {
randomNum = Math.floor(Math.random() * data.length);
trace(randomNum);
}
loadImages(data,randomNum)
;
randomNumLast = randomNum;
} else if (_global.order=="sequentia
l") {
// start at 0, increment to total number of images, then drop back to zero when done
if (p==undefined || p==data.length && _global.looping=="yes") { p=0; } else { break; }
loadImages(data,p);
p++;
} else {
trace ("order attribute in xml isn't correct - must specify either 'random' or 'sequential'");
}
clearInterval(timerInterva
l);
}
stop();
Start Free Trial