conditional statement for loaded swf
I am initiating loading a swf file, "bg1.swf". I have a button that, when clicked, is suppose to check to see if "bg1.swf" is loaded. I cant figure out how to write the conditional "if" part. Currently, instead of checking to see if my statement is actually true, it executes loading bg1Req? Here is the code ...
var bgLoader:Loader = new Loader();
var bg1Req = new URLRequest("bg1.swf");
var bg2Req = new URLRequest("bg2.swf");
bgLoader.load(bg1Req);
this.addChild(bgLoader);
function goSection(event:MouseEvent):void {
//unload BG Image
if (bgLoader.load(bg1Req)==true) {
bgLoader.unloadAndStop();
bgLoader.load(bg2Req);
this.addChild(bgLoader);
}else{
trace("bg 2 is loaded");
}
}
btn.addEventListener(MouseEvent.CLICK, goSection);