Hello,
I am a Flash beginner. I am creating a web site using Flash CS4 and AS3. I have been able to create the pages by using frame labels. Every was going fine until tried dynamically loading a SWF file (previously created). The problem is I’ve placed the code for the SWF load on the frame label that I want it to load into which works fine. However when I click on any to the other pages the SWF file is displayed also. Can anyone tell me how to stop this from happening? Is their an event listener for leaving a frame? I am attaching my code in the hopes that someone know where I am going wrong.
function loadProducts()
{
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("productsv1.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
}
function onCompleteHandler(loadEvent:Event)
{
var ploader:MovieClip = new prodLoader();
loadEvent.currentTarget.content.x = 0;
loadEvent.currentTarget.content.y = 0;
ploader.addChild(loadEvent.currentTarget.content);
ploader.x = 0;
ploader.y = 160;
ploader.width = 800;
ploader.height = 400;
addChild(ploader);
}
function onProgressHandler(mProgress:ProgressEvent)
{
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
}
loadProducts();