[AS3] Center images loaded dynamicly
Hi
I have several images that are loaded dynamic. Now I want them to center in the container. How is that done? I can get the width and height but I can't adjust the x values on the loaderinfo object.
Heres part of the code:
... part of function ...
for (var i:uint=0; i<numPictures; i++) {
var pictLdr:Loader = new Loader();
var pictURLReq:URLRequest=new URLRequest("png/"+i+".png");
pictLdr.load(pictURLReq);
pictLdr.contentLoaderInfo.addEventListener(Event.C OMPLETE, onImageComplete);
}
...
function onImageComplete(e:Event):void
{
var info:LoaderInfo = LoaderInfo( e.target );
trace( info.width, info.height ); //this traces fine but how do I then center?
}