I’m trying to update images through a timer. I only can upload one image at time. If i were to remove the image and upload another image. Then my app should update to most current image real time. For some reason it is not reading my newUpdate functions. “newUpdate” function should compare the xml then reload image if xml file don’t match. I need assistance on my update function. Maybe my logic for the update functions is wrong, any help would be appreciated. Thank you
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML;
var imageList:XMLList;
var imageLoader:Loader = new Loader();
var imageIndex:uint = 0;
var child:DisplayObject;
var timer:Timer =new Timer(3000,0);
var myImageHolder = new ImageHolder();
addChild(myImageHolder);
myImageHolder.x= 0;
myImageHolder.y= 0;
function newUpdate(e:TimerEvent) {
if (imageList != xmlData.sectionItem.file) {
newScreensaver();
}
}
function newScreensaver() {
xmlLoader.load(new URLRequest(path +"metv.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
addChild(videoTxt);
}
function xmlLoaded(e:Event) {
xmlData = new XML ( e.target.data);
imageList = xmlData.sectionItem.file;
loadImage(path + imageList[0]);
}
function imageLoaded(e:Event){
child = myImageHolder.addChild(imageLoader);
}
function loadImage(path:String){
imageLoader.load(new URLRequest( path));
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,imageLoaded);
}
I don’t think you have given enough context to answer the question, because the line:
Will never yeild true because of the line:
Please explain at what point and why either xmlData or imageList will change value after the initial XML data is loaded.
…maybe that is the problem?