# Animated image loop with AS3

**URL:** https://forum.kirupa.com/t/animated-image-loop-with-as3/267305
**Category:** flash
**Created:** [July 30, 2008, 3:50pm UTC](https://forum.kirupa.com/t/animated-image-loop-with-as3/267305 "2008-07-30T15:50:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![md3](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@md3](https://forum.kirupa.com/u/md3)
#### Post date: [July 30, 2008, 3:50pm UTC](https://forum.kirupa.com/t/animated-image-loop-with-as3/267305/1 "2008-07-30T15:50:57Z")

</div>

Hello. I’m new to AS3 and need some help creating an animated loop with dynamic images loaded from an xml document. I have it all working except I was wondering if there was a way for the images to transition in a way they look like an animated weather radar loop instead of it blanking out in between images. I’d like for it to look something like this: [http://www.internet-graffiti.com/hurricane-rita.html](http://www.internet-graffiti.com/hurricane-rita.html), and less like an image gallery. Is there a way to do that? Here is my code:

import flash.display._;  
import flash.events._;  
import [flash.net](http://flash.net)._;  
import flash.text._;

var picNumber = -1;  
var imageLoader = new Loader();

var myXML:XML;  
var myLoader:URLLoader = new URLLoader();  
myLoader.load(new URLRequest(“images2.xml”));  
myLoader.addEventListener(Event.COMPLETE, processXML);

function processXML(e:Event):void {  
myXML = new XML(e.target.data);  
for (var i:int = 0; i\<myXML._.length(); i++){  
trace("My image number is " + (i+1) + " and it’s URL is " + myXML.image_);  
};  
}

function loadImage(url:String):void {  
// Set properties on my Loader object  
//imageLoader = new Loader();  
imageLoader.load(new URLRequest(url));  
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);  
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);  
}

function imageLoaded(e:Event):void {  
// Load Image  
imageLoader.width = 650;  
imageLoader.height = 425;  
imageArea.addChild(imageLoader);  
}

var myTimer:Timer = new Timer(200); // 1 second  
myTimer.addEventListener(TimerEvent.TIMER, setURL);  
myTimer.start();

function setURL(event:TimerEvent):void {  
if (picNumber\>=myXML.\*.length()-1) {  
picNumber = 0;  
} else {  
picNumber++;  
}  
trace("image: "+myXML.image[picNumber]);  
loadImage(myXML.image[picNumber]);  
}

Thanks for any help!
