Hey Friends, I am trying to figure out the best way to unload an image before loading another in my onComplete function.
I have tried using a removeChild call but it says the DisplayObject must be a child of the Caller - not sure what that means. I had help on this and am not familiar with all of it.
The images I use now have transparent parts that can be seen when they load over top of each other. I need that to stop. Your expertise is very much appreciated!
function loadImages(showN:int){
preLoader.start();
var urlRequest:URLRequest = new URLRequest(showData[showName]);
marqLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onMarqProgressStatus);
marqLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioMarqErrorListener);
marqLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onMarqCompleteStatus);
marqLoader.load(urlRequest);
loadThumbs();
}
function ioMarqErrorListener(e:IOErrorEvent):void
{
trace("ERROR DETECTED:" + IOErrorEvent);
var urlRequest:URLRequest = new URLRequest("images/bannerFail.png");
marqLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onMarqProgressStatus);
marqLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioMarqErrorListener);
marqLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onMarqCompleteStatus);
marqLoader.load(urlRequest);
}
function onMarqProgressStatus(e:ProgressEvent):void
{
var loadPercent:int = Math.ceil( ( e.bytesLoaded / e.bytesTotal ) * 100 );
}
function onMarqCompleteStatus(e:Event):void
{
var imgArr = new Array();
var imgloaderInfo:LoaderInfo = e.target as LoaderInfo;
imgArr.push(imgloaderInfo.content);
marqDisplay_mc.addChild(imgArr[0])
preLoader.stop();
}