I created a image rotator and having a slight problem. Every time that is changes the background flickers and I do not have a glue on how to stop it.
Code:
var carousel:XML = new XML();
carousel.ignoreWhite = true;
var carTitle:Array = new Array();
var carDescription:Array = new Array();
var carImage:Array = new Array();
var carBackground:Array = new Array();
var carLink:Array = new Array();
var carIsOn:Number;
var holdLink:String;
carousel.onLoad = function(success){
var carActions:Array = this.firstChild.childNodes;
for(i=0;i<carActions.length;i++){
carTitle.push(carActions[i].attributes.cartitle);
carDescription.push(carActions[i].attributes.cardescription);
carLink.push(carActions[i].attributes.carlink);
carImage.push(carActions[i].attributes.carimage);
carBackground.push(carActions[i].attributes.carbackground);
}
holdBackground.loadMovie(carBackground[0]);
holdImage.loadMovie(carImage[0]);
holdTitle.htmlText = carTitle[0];
holdDescription.htmlText = carDescription[0];
holdLink = carLink[0];
carIsOn = 0;
}
carousel.load("carousel.xml");
carInterval = setInterval(rotate, 10000);
function rotate() {
if(carIsOn > carTitle.length-2){
holdBackground.loadMovie(carBackground[0]);
holdImage.loadMovie(carImage[0]);
holdTitle.htmlText = carTitle[0];
holdDescription.htmlText = carDescription[0];
holdLink = carLink[0];
carIsOn = 0;
} else {
carIsOn++;
holdBackground.loadMovie(carBackground[carIsOn]);
holdImage.loadMovie(carImage[carIsOn]);
holdTitle.htmlText = carTitle[carIsOn];
holdDescription.htmlText = carDescription[carIsOn];
holdLink = carLink[carIsOn];
}
}
TIA